Skip to content

Commit e02641e

Browse files
committed
fix: correct GitHub Actions trigger and enforce lowercase repo name for GHCR
1 parent 79fa09e commit e02641e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/docker-image.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
name: Docker Iamge CI for GHCR
1+
name: Docker Image CI for GHCR
22

33
on:
44
push:
55
tags:
66
- 'v*.*.*'
7-
pull_request:
8-
tags:
9-
- 'v*.*.*'
107

118
jobs:
12-
139
build_and_publish:
1410
runs-on: ubuntu-latest
1511
steps:
1612
- uses: actions/checkout@v4
17-
- name: Build the push the image
13+
14+
- name: Convert repository name to lowercase
15+
run: echo "LOWER_REPO_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
16+
17+
- name: Login to GitHub Container Registry
18+
run: docker login --username zhou-jianwen --password ${{ secrets.GH_PAT }} ghcr.io
19+
20+
- name: Build and push the image
1821
run: |
19-
docker login --username zhou-jianwen --password ${{ secrets.GH_PAT}} ghcr.io
20-
docker build . --file build/Dockerfile --tag ghcr.io/${{ github.repository }}:${{ github.ref_name }}
21-
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}
22+
docker build . --file build/Dockerfile --tag ghcr.io/$LOWER_REPO_NAME:${{ github.ref_name }}
23+
docker push ghcr.io/$LOWER_REPO_NAME:${{ github.ref_name }}

0 commit comments

Comments
 (0)