Skip to content

Update, build and push Docker images #2698

Update, build and push Docker images

Update, build and push Docker images #2698

Workflow file for this run

name: Update, build and push Docker images
on:
schedule:
- cron: "12 */4 * * *"
push:
branches:
- master
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
container:
image: hairyhenderson/dockerfiles-builder:latest
env:
BASHBREW_LIBRARY: ./library
BASHBREW_NAMESPACE: productionwentdown
BASHBREW_ARCH_NAMESPACES: amd64=productionwentdown
if: github.repository == 'productionwentdown/caddy' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git config --global --add safe.directory $(pwd)
- name: Install Go
run: |
apk add --no-cache go
- name: Regenerate Dockerfiles
run: |
go run update.go -dockerfiles -readme
- name: Commit and push changes
id: commit-dockerfiles
run: |
git add */*/Dockerfile README.md
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'
id: commit-bashbrew
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"
fi
- name: Build images on Linux
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
run: |
bashbrew build --pull always caddy
- name: Push images
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
run: |
wget https://github.com/estesp/manifest-tool/releases/download/v2.1.6/binaries-manifest-tool-2.1.6.tar.gz -O manifest-tool.tar.gz
tar -xf manifest-tool.tar.gz
mv manifest-tool-linux-amd64 /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 --single-arch caddy
#- name: Update Docker Hub Description
# uses: peter-evans/dockerhub-description@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# repository: productionwentdown/caddy