Skip to content

Commit fed1f8f

Browse files
committed
Fix Docker image tag case sensitivity issue
Signed-off-by: Jack Luar <[email protected]>
1 parent 044093a commit fed1f8f

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

.github/workflows/ci-secret.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,22 @@ jobs:
7070
username: ${{ github.actor }}
7171
password: ${{ secrets.GITHUB_TOKEN }}
7272

73+
- name: Set lowercase repository name
74+
run: |
75+
echo "REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
76+
7377
- name: Build and push backend Docker image
7478
uses: docker/build-push-action@v5
7579
with:
7680
context: ./backend
7781
push: true
7882
tags: |
79-
ghcr.io/${{ github.repository }}/backend:latest
80-
ghcr.io/${{ github.repository }}/backend:${{ github.sha }}
83+
ghcr.io/${{ env.REPO_LOWER }}/backend:latest
84+
ghcr.io/${{ env.REPO_LOWER }}/backend:${{ github.sha }}
8185
cache-from: |
82-
type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache
83-
type=registry,ref=ghcr.io/${{ github.repository }}/backend:latest
84-
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache,mode=max
86+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache
87+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest
88+
cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache,mode=max
8589
load: true
8690

8791
- name: Build and push frontend Docker image
@@ -90,12 +94,12 @@ jobs:
9094
context: ./frontend/nextjs-frontend
9195
push: true
9296
tags: |
93-
ghcr.io/${{ github.repository }}/frontend:latest
94-
ghcr.io/${{ github.repository }}/frontend:${{ github.sha }}
97+
ghcr.io/${{ env.REPO_LOWER }}/frontend:latest
98+
ghcr.io/${{ env.REPO_LOWER }}/frontend:${{ github.sha }}
9599
cache-from: |
96-
type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache
97-
type=registry,ref=ghcr.io/${{ github.repository }}/frontend:latest
98-
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache,mode=max
100+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache
101+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest
102+
cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache,mode=max
99103
load: true
100104

101105
- name: Start services with docker compose

.github/workflows/ci.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,28 @@ jobs:
5858
username: ${{ github.actor }}
5959
password: ${{ secrets.GITHUB_TOKEN }}
6060

61+
- name: Set lowercase repository name
62+
run: |
63+
echo "REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
64+
6165
- name: Build backend Docker image with cache
6266
uses: docker/build-push-action@v5
6367
with:
6468
context: ./backend
6569
push: false
66-
tags: ghcr.io/${{ github.repository }}/backend:pr-${{ github.event.pull_request.number }}
70+
tags: ghcr.io/${{ env.REPO_LOWER }}/backend:pr-${{ github.event.pull_request.number }}
6771
cache-from: |
68-
type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache
69-
type=registry,ref=ghcr.io/${{ github.repository }}/backend:latest
70-
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache,mode=max
72+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache
73+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest
74+
cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache,mode=max
7175

7276
- name: Build frontend Docker image with cache
7377
uses: docker/build-push-action@v5
7478
with:
7579
context: ./frontend/nextjs-frontend
7680
push: false
77-
tags: ghcr.io/${{ github.repository }}/frontend:pr-${{ github.event.pull_request.number }}
81+
tags: ghcr.io/${{ env.REPO_LOWER }}/frontend:pr-${{ github.event.pull_request.number }}
7882
cache-from: |
79-
type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache
80-
type=registry,ref=ghcr.io/${{ github.repository }}/frontend:latest
81-
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache,mode=max
83+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache
84+
type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest
85+
cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache,mode=max

0 commit comments

Comments
 (0)