name: Update, build and push Docker images on: schedule: - cron: "12 */4 * * *" push: branches: - master 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: Install Go run: | apk add --no-cache go - 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.outputs.bumped == 'yes' run: | go run update.go -manifest -commit $(git log -1 --format='format:%H' HEAD) - 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 - name: Build images on Linux if: steps.commit-dockerfiles.outputs.bumped == 'yes' run: | bashbrew build --pull always caddy - name: Push images if: steps.commit-dockerfiles.outputs.bumped == 'yes' run: | 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 echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin bashbrew push caddy bashbrew put-shared caddy - name: Ping microbadger if: steps.commit-dockerfiles.outputs.bumped == 'yes' run: curl -X POST https://hooks.microbadger.com/images/productionwentdown/caddy/OVgee2in7ldJ7GgTZiScpwH_mTs=