Skip to content

Commit 30aee47

Browse files
committed
refactor: update Docker publish workflow to compute lowercase image name dynamically
1 parent eff3a8b commit 30aee47

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/docker-publish.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "v*"
77

88
env:
9+
# Will be overridden by computed lowercase value below
910
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/nyaa-proxy
1011

1112
jobs:
@@ -35,15 +36,22 @@ jobs:
3536
id: vars
3637
run: echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
3738

39+
- name: Compute lowercase image name
40+
id: imagename
41+
shell: bash
42+
run: |
43+
owner_lc="${GITHUB_REPOSITORY_OWNER,,}"
44+
echo "name=ghcr.io/${owner_lc}/nyaa-proxy" >> "$GITHUB_OUTPUT"
45+
3846
- name: Build and push image
3947
uses: docker/build-push-action@v5
4048
with:
4149
context: .
4250
platforms: linux/amd64,linux/arm64
4351
push: true
4452
tags: |
45-
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.VERSION }}
46-
${{ env.IMAGE_NAME }}:latest
53+
${{ steps.imagename.outputs.name }}:${{ steps.vars.outputs.VERSION }}
54+
${{ steps.imagename.outputs.name }}:latest
4755
labels: |
4856
org.opencontainers.image.source=${{ github.repository }}
4957
org.opencontainers.image.version=${{ steps.vars.outputs.VERSION }}
@@ -52,6 +60,6 @@ jobs:
5260
5361
- name: Publish summary
5462
run: |
55-
echo "Published: ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.VERSION }}"
56-
echo "Also tagged: ${{ env.IMAGE_NAME }}:latest"
57-
echo "Pull with: docker pull ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.VERSION }}"
63+
echo "Published: ${{ steps.imagename.outputs.name }}:${{ steps.vars.outputs.VERSION }}"
64+
echo "Also tagged: ${{ steps.imagename.outputs.name }}:latest"
65+
echo "Pull with: docker pull ${{ steps.imagename.outputs.name }}:${{ steps.vars.outputs.VERSION }}"

0 commit comments

Comments
 (0)