Skip to content

Commit ec7121a

Browse files
committed
fix: workflow tag
1 parent 358f62a commit ec7121a

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/publish_ghcr.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,25 @@ jobs:
3030
username: ${{ github.actor }}
3131
password: ${{ secrets.GITHUB_TOKEN }}
3232

33+
- name: Extract version from tag
34+
id: extract_version
35+
run: |
36+
REF_NAME=${GITHUB_REF#refs/tags/}
37+
VERSION=${REF_NAME#v}
38+
echo "VERSION=$VERSION" >> $GITHUB_ENV
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
3341
- name: Build and push Docker image
3442
uses: docker/build-push-action@v4
3543
env:
36-
TAG_NAME: ${{ github.ref && startsWith(github.ref, 'refs/tags/') && replace(replace(github.ref, 'refs/tags/', ''), 'v', '') || 'latest' }}
44+
VERSION: ${{ steps.extract_version.outputs.version }}
3745
with:
3846
context: .
3947
push: true
4048
platforms: linux/amd64,linux/arm64/v8
4149
tags: |
42-
ghcr.io/${{ github.repository_owner }}/etherproxy:${{ env.TAG_NAME }}
50+
ghcr.io/${{ github.repository_owner }}/etherproxy:${{ env.VERSION }}
4351
ghcr.io/${{ github.repository_owner }}/etherproxy:latest
4452
labels: |
45-
org.opencontainers.image.version=${{ env.TAG_NAME }}
53+
org.opencontainers.image.version=${{ env.VERSION }}
4654
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}

0 commit comments

Comments
 (0)