Skip to content

Commit 07d4ec6

Browse files
committed
Fix Docker tag for PR builds: replace / with -
github.ref_name is "172/merge" for PRs, which is invalid in Docker tags. Use bash substitution to replace / with -. Committed-By-Agent: claude
1 parent 73e2b87 commit 07d4ec6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ jobs:
5353

5454
- name: Build Docker image
5555
run: |
56+
TAG="${GITHUB_REF_NAME//\//-}"
5657
docker build \
5758
--build-arg GIT_COMMIT=${{ github.sha }} \
5859
--build-arg BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
5960
--build-arg COMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} \
6061
-t ghcr.io/${{ github.repository }}:${{ github.sha }} \
61-
-t ghcr.io/${{ github.repository }}:${{ github.ref_name }} \
62+
-t ghcr.io/${{ github.repository }}:${TAG} \
6263
.
6364
6465
- name: Push Docker image
6566
run: |
67+
TAG="${GITHUB_REF_NAME//\//-}"
6668
docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
67-
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}
69+
docker push ghcr.io/${{ github.repository }}:${TAG}
6870
6971
- name: Docker smoke test
7072
run: docker run --rm ghcr.io/${{ github.repository }}:${{ github.sha }} --version

0 commit comments

Comments
 (0)