Skip to content

Merge pull request #2 from BretFisher/cron-build #6

Merge pull request #2 from BretFisher/cron-build

Merge pull request #2 from BretFisher/cron-build #6

---
# THIS IS NOT A TEMPLATE.
# This is just for testing the repo itself.
# This calls the reusable workflow from its local file path.
name: Docker Build with Promotion
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- '.github/linters/**'
pull_request:
paths-ignore:
- 'README.md'
- '.github/linters/**'
schedule:
# re-run monthly to keep image fresh with upstream base images
- cron: '0 12 15 * *'
# cancel any previously-started, yet still active runs of this workflow on the same branch
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
packages: write # needed to push docker image to ghcr.io
pull-requests: write # needed to create and update comments in PRs
jobs:
# run this job on every push to a PR
# it will push images to GHCR, but not Docker Hub
docker-build-pr:
name: Call Build on PR
if: github.event_name == 'pull_request'
uses: bretfisher/docker-build-workflow/.github/workflows/reusable-docker-build.yaml@main
with:
# DON'T login to or push to Docker Hub
dockerhub-enable: false
ghcr-enable: true
push: true
platforms: linux/amd64,linux/arm64
image-names: |
ghcr.io/${{ github.repository }}
# run this job on every push to the default branch (including merges and tags)
# it will push images to GHCR and DockerHub
# tags will also include ones like `stable-<date>-<sha>` and `latest`
docker-build-merge:
name: Call Build on Push
# this if is filtered to only the main branch push event (see events at top)
if: github.event_name == 'push'
uses: bretfisher/docker-build-workflow/.github/workflows/reusable-docker-build.yaml@main
secrets:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
with:
dockerhub-enable: true
ghcr-enable: true
push: true
platforms: linux/amd64,linux/arm64
image-names: |
docker.io/${{ github.repository }}
ghcr.io/${{ github.repository }}