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

77 lines
2.3 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
jobs:
docker:
runs-on: ubuntu-latest
container:
image: hairyhenderson/dockerfiles-builder:latest
env:
BASHBREW_LIBRARY: ./library
BASHBREW_NAMESPACE: 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: |
go run update.go -dockerfiles
- 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: |
git add */*/Dockerfile
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
2020-07-03 00:42:23 +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
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
run: |
git add library/caddy
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m "Bump Caddy version" -a
git push
fi
2020-07-03 01:05:56 +08:00
- name: Build images on Linux
2020-07-03 00:42:23 +08:00
if: steps.commit-dockerfiles.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
2020-07-03 00:42:23 +08:00
if: steps.commit-dockerfiles.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
2020-07-03 01:17:01 +08:00
bashbrew put-shared caddy
2020-05-16 13:29:38 +08:00
2020-07-03 01:05:56 +08:00
- name: Ping microbadger
2020-07-03 00:42:23 +08:00
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
2020-05-16 13:29:38 +08:00
run: curl -X POST https://hooks.microbadger.com/images/productionwentdown/caddy/OVgee2in7ldJ7GgTZiScpwH_mTs=