Skip to content

Commit 19287ec

Browse files
committed
chore(cd): refactor registry image handling in CD configuration
1 parent f79710d commit 19287ec

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/cd.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
tags:
77
- 'v*'
88

9+
env:
10+
REGISTRY_IMAGE: ${{ github.repository }}
11+
912
jobs:
1013
build-image:
1114
name: Build Image
@@ -39,7 +42,7 @@ jobs:
3942
id: meta
4043
uses: docker/metadata-action@v4
4144
with:
42-
images: ghcr.io/${{ github.repository }}
45+
images: ${{ env.REGISTRY_IMAGE }}
4346

4447
- name: Set up Docker Buildx
4548
uses: docker/setup-buildx-action@v2
@@ -57,8 +60,9 @@ jobs:
5760
with:
5861
context: .
5962
file: ./Dockerfile
60-
platforms: ${{ matrix.platforms.platform }}
63+
tags: ${{ env.REGISTRY_IMAGE }}
6164
labels: ${{ steps.meta.outputs.labels }}
65+
platforms: ${{ matrix.platforms.platform }}
6266
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
6367
cache-from: type=gha
6468
cache-to: type=gha,mode=max
@@ -106,7 +110,7 @@ jobs:
106110
id: meta
107111
uses: docker/metadata-action@v4
108112
with:
109-
images: ghcr.io/${{ github.repository }}
113+
images: ${{ env.REGISTRY_IMAGE }}
110114
tags: |
111115
type=raw,value=latest
112116
type=sha
@@ -116,4 +120,4 @@ jobs:
116120
working-directory: ${{ runner.temp }}/digests
117121
run: |
118122
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
119-
$(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
123+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)

0 commit comments

Comments
 (0)