Skip to content

Commit 7efd56d

Browse files
committed
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.
1 parent 324ec44 commit 7efd56d

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

.github/workflows/docker-3.2.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ on:
55
branches:
66
- 3.2
77
workflow_dispatch:
8+
# Every week at 8am on Mondays, publish the 3.2 branch:
9+
# NOTE: `schedule` event is only triggered for the default branch:
10+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
811
schedule:
912
- cron: "0 8 * * 1"
1013

1114
env:
12-
BUILD_VERSION: "3.2"
13-
DOCKER_CLI_EXPERIMENTAL: enabled
15+
GIT_BRANCH: "3.2"
1416

1517
jobs:
1618

@@ -23,7 +25,7 @@ jobs:
2325

2426
- name: Setup QEMU
2527
id: qemu
26-
uses: docker/setup-qemu-action@v3.6.0
28+
uses: docker/setup-qemu-action@v3
2729

2830
- name: Setup Buildx
2931
id: buildx
@@ -35,29 +37,30 @@ jobs:
3537
with:
3638
images: ${{ github.repository }}
3739
labels: |
38-
org.opencontainers.image.version=${{ env.BUILD_VERSION }}
40+
org.opencontainers.image.version=${{ env.GIT_BRANCH }}
3941
org.opencontainers.image.revision=${{ github.sha }}
4042
org.opencontainers.image.title=${{ github.repository }}
4143
4244
- name: GitHub login
4345
if: ${{ github.event_name != 'pull_request' }}
44-
uses: docker/login-action@v3.4.0
46+
uses: docker/login-action@v3
4547
with:
4648
registry: ghcr.io
47-
username: ${{ github.actor }}
49+
username: ${{ github.repository_owner }}
4850
password: ${{ secrets.GITHUB_TOKEN }}
4951

5052
- name: Build and push
51-
uses: docker/build-push-action@v6.16.0
53+
uses: docker/build-push-action@v6
5254
with:
5355
push: ${{ github.event_name != 'pull_request' }}
5456
context: .
55-
file: Dockerfile-alpine
57+
file: Dockerfile.alpine
5658
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le
57-
build-args: BUILD_VERSION
59+
build-args:
60+
- GIT_BRANCH
5861
cache-from: type=gha, scope=${{ github.workflow }}
5962
cache-to: type=gha, scope=${{ github.workflow }}
6063
labels: ${{ steps.docker_meta.outputs.labels }}
6164
tags: |
62-
ghcr.io/${{ github.repository }}:${{ env.BUILD_VERSION }}
65+
ghcr.io/${{ github.repository }}:${{ env.GIT_BRANCH }}
6366
ghcr.io/${{ github.repository }}:latest

0 commit comments

Comments
 (0)