ci: docker-3.2.yml - Minor revisions

- Add note about `schedule` event trigger
- `BUILD_VERSION` => `GIT_BRANCH`
- `Dockerfile-alpine` => `Dockerfile.alpine`
- For GHCR username, prefer using `repository_owner` from workflow context which is correct vs `actor` which could be any user capable of triggering the workflow at the repo (which may not align with the expected GHCR username.
This commit is contained in:
polarathene
2025-05-12 10:50:29 +12:00
parent 324ec443db
commit 7efd56d9b0

View File

@ -5,12 +5,14 @@ on:
branches: branches:
- 3.2 - 3.2
workflow_dispatch: workflow_dispatch:
# Every week at 8am on Mondays, publish the 3.2 branch:
# NOTE: `schedule` event is only triggered for the default branch:
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
schedule: schedule:
- cron: "0 8 * * 1" - cron: "0 8 * * 1"
env: env:
BUILD_VERSION: "3.2" GIT_BRANCH: "3.2"
DOCKER_CLI_EXPERIMENTAL: enabled
jobs: jobs:
@ -23,7 +25,7 @@ jobs:
- name: Setup QEMU - name: Setup QEMU
id: qemu id: qemu
uses: docker/setup-qemu-action@v3.6.0 uses: docker/setup-qemu-action@v3
- name: Setup Buildx - name: Setup Buildx
id: buildx id: buildx
@ -35,29 +37,30 @@ jobs:
with: with:
images: ${{ github.repository }} images: ${{ github.repository }}
labels: | labels: |
org.opencontainers.image.version=${{ env.BUILD_VERSION }} org.opencontainers.image.version=${{ env.GIT_BRANCH }}
org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.title=${{ github.repository }} org.opencontainers.image.title=${{ github.repository }}
- name: GitHub login - name: GitHub login
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3.4.0 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v6.16.0 uses: docker/build-push-action@v6
with: with:
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
context: . context: .
file: Dockerfile-alpine file: Dockerfile.alpine
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le
build-args: BUILD_VERSION build-args:
- GIT_BRANCH
cache-from: type=gha, scope=${{ github.workflow }} cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }} cache-to: type=gha, scope=${{ github.workflow }}
labels: ${{ steps.docker_meta.outputs.labels }} labels: ${{ steps.docker_meta.outputs.labels }}
tags: | tags: |
ghcr.io/${{ github.repository }}:${{ env.BUILD_VERSION }} ghcr.io/${{ github.repository }}:${{ env.GIT_BRANCH }}
ghcr.io/${{ github.repository }}:latest ghcr.io/${{ github.repository }}:latest