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

63 lines
1.7 KiB
YAML

name: Update, build and push Docker images
on:
schedule:
- cron: "12 */4 * * *"
push:
branches:
- master
paths:
- library/caddy
jobs:
docker:
runs-on: ubuntu-latest
container:
image: hairyhenderson/dockerfiles-builder:latest
env:
BASHBREW_LIBRARY: ./library
BASHBREW_NAMESPACE: productionwentdown
if: github.repository == 'productionwentdown/caddy' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Set Git user
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Regenerate Dockerfiles
run: |
go run update.go -dockerfiles
- name: Commit and push changes
id: commit_dockerfiles
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
if: steps.commit_dockerfiles.bumped == 'yes'
run: |
go run update.go -manifest -commit $(git log -1 --format='format:%H' HEAD)
- name: Build on Linux
if: steps.commit_dockerfiles.bumped == 'yes'
run: |
bashbrew build --pull always caddy
- name: push
if: steps.commit_dockerfiles.bumped == 'yes'
run: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
bashbrew push caddy
- name: microbadger
if: steps.commit_dockerfiles.bumped == 'yes'
run: curl -X POST https://hooks.microbadger.com/images/productionwentdown/caddy/OVgee2in7ldJ7GgTZiScpwH_mTs=