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 00:31:29 +08:00
|
|
|
- name: Build 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
|
|
|
|
|
|
|
- name: push
|
2020-07-03 00:42:23 +08:00
|
|
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
|
2020-05-13 14:21:13 +08:00
|
|
|
run: |
|
|
|
|
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
|
|
|
bashbrew push caddy
|
2020-05-16 13:29:38 +08:00
|
|
|
|
|
|
|
- name: 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=
|