1
0
Fork 0
caddy/.github/workflows/build.yml

84 lines
2.6 KiB
YAML
Raw Normal View History

2020-07-03 00:31:29 +08:00
name: Update, build and push Docker images
2020-05-13 14:21:13 +08:00
on:
2020-07-03 00:31:29 +08:00
schedule:
- cron: "12 */4 * * *"
2020-05-13 14:21:13 +08:00
push:
branches:
- master
2021-11-16 13:51:43 +08:00
workflow_dispatch:
2020-05-13 14:21:13 +08:00
jobs:
docker:
runs-on: ubuntu-latest
container:
image: hairyhenderson/dockerfiles-builder:latest
env:
BASHBREW_LIBRARY: ./library
BASHBREW_NAMESPACE: productionwentdown
2021-11-16 14:50:16 +08:00
BASHBREW_ARCH_NAMESPACES: amd64=productionwentdown
2020-07-03 00:31:29 +08:00
if: github.repository == 'productionwentdown/caddy' && github.ref == 'refs/heads/master'
2020-05-13 14:21:13 +08:00
steps:
- uses: actions/checkout@v2
2020-07-03 00:31:29 +08:00
- name: Set Git user
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
2020-07-03 00:34:56 +08:00
- name: Install Go
run: |
apk add --no-cache go
2020-07-03 00:31:29 +08:00
- name: Regenerate Dockerfiles
run: |
2021-11-16 14:22:55 +08:00
go run update.go -dockerfiles -readme
2020-07-03 00:31:29 +08:00
- name: Commit and push changes
2020-07-03 00:42:23 +08:00
id: commit-dockerfiles
2020-07-03 00:31:29 +08:00
run: |
2021-11-16 15:07:56 +08:00
git add */*/Dockerfile README.md
2020-07-03 00:31:29 +08:00
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m "Bump Caddy version" -a
git push
echo "::set-output name=bumped::yes"
fi
- name: Regenerate Bashbrew manifests
2021-05-12 08:37:22 +08:00
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
2020-07-03 00:31:29 +08:00
run: |
go run update.go -manifest -commit $(git log -1 --format='format:%H' HEAD)
2020-07-03 01:01:19 +08:00
- name: Commit and push changes
2021-05-12 08:37:22 +08:00
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
2021-05-11 23:14:57 +08:00
id: commit-bashbrew
2020-07-03 01:01:19 +08:00
run: |
git add library/caddy
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m "Bump Caddy version" -a
git push
echo "::set-output name=bumped::yes"
2020-07-03 01:01:19 +08:00
fi
2020-07-03 01:05:56 +08:00
- name: Build images on Linux
2021-05-11 23:14:57 +08:00
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
2020-07-03 00:31:29 +08:00
run: |
bashbrew build --pull always caddy
2020-05-13 14:21:13 +08:00
2020-07-03 01:05:56 +08:00
- name: Push images
2021-05-11 23:14:57 +08:00
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
2020-05-13 14:21:13 +08:00
run: |
2020-07-03 01:32:05 +08:00
wget https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64 -O /usr/local/bin/manifest-tool
chmod +x /usr/local/bin/manifest-tool
2020-05-13 14:21:13 +08:00
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
bashbrew push caddy
2021-05-12 08:52:23 +08:00
bashbrew put-shared --single-arch caddy
2021-11-16 15:07:56 +08:00
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: productionwentdown/caddy