Skip to content

Commit 414645b

Browse files
authored
always build and publish dockerfile
1 parent d93ef16 commit 414645b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/docker-publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
3535
push-to-ghcr:
3636
runs-on: ubuntu-latest
37-
if: github.ref == 'refs/heads/main'
37+
# if: github.ref == 'refs/heads/main'
3838
needs: build-test
3939
permissions:
4040
contents: read
@@ -63,6 +63,16 @@ jobs:
6363
run: |
6464
echo "LOWERCASE_REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
6565
66+
- name: Set IMAGE_TAG for build-test
67+
run: |
68+
if [ "${{ github.event_name }}" = "pull_request" ]; then
69+
echo "IMAGE_TAG=test" >> $GITHUB_ENV
70+
elif [ "${{ github.ref }}" = "refs/heads/main" ]; then
71+
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
72+
else
73+
echo "IMAGE_TAG=${GITHUB_SHA::8}" >> $GITHUB_ENV
74+
fi
75+
6676
- name: Extract metadata for Docker
6777
id: meta
6878
uses: docker/metadata-action@v5
@@ -77,6 +87,6 @@ jobs:
7787
file: ./docker/Dockerfile
7888
push: true
7989
tags: |
80-
ghcr.io/${{ env.LOWERCASE_REPO }}:latest
90+
ghcr.io/${{ env.LOWERCASE_REPO }}:${{ env.IMAGE_TAG }}
8191
ghcr.io/${{ env.LOWERCASE_REPO }}:${{ github.sha }}
8292
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)