62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
---
|
|
# 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:
|
|
- main
|
|
paths-ignore:
|
|
- 'README.md'
|
|
- '.github/linters/**'
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'README.md'
|
|
- '.github/linters/**'
|
|
|
|
# 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
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
|
|
# run this job on every push to a PR
|
|
# it will push images to GHCR, but not DockerHub
|
|
docker-build-pr:
|
|
name: Call Build on PR
|
|
if: github.event_name == 'pull_request'
|
|
uses: ./.github/workflows/reusable-docker-build.yaml
|
|
with:
|
|
dockerhub-enable: false
|
|
ghcr-enable: true
|
|
push: true
|
|
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: ./.github/workflows/reusable-docker-build.yaml
|
|
secrets:
|
|
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
with:
|
|
dockerhub-enable: true
|
|
ghcr-enable: true
|
|
push: true
|
|
image-names: |
|
|
docker.io/${{ github.repository }}
|
|
ghcr.io/${{ github.repository }}
|