Skip to content

Commit 358f62a

Browse files
committed
feat: change tag and trigger to git tags
1 parent 42bc9f8 commit 358f62a

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

.github/workflows/publish_ghcr.yaml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
release:
55
types: [published]
66
push:
7-
branches:
8-
- master
7+
tags:
8+
- "*"
99
workflow_dispatch:
1010

1111
jobs:
@@ -19,33 +19,28 @@ jobs:
1919
uses: actions/checkout@v3
2020
with:
2121
fetch-depth: 0
22-
22+
2323
- name: Set up Docker Buildx
2424
uses: docker/setup-buildx-action@v2
25-
25+
2626
- name: Log in to GitHub Container Registry
2727
uses: docker/login-action@v2
2828
with:
2929
registry: ghcr.io
3030
username: ${{ github.actor }}
3131
password: ${{ secrets.GITHUB_TOKEN }}
32-
33-
- name: Get version from package.json
34-
id: package-version
35-
run: |
36-
VERSION=$(node -p "require('./package.json').version")
37-
echo "VERSION=$VERSION" >> $GITHUB_ENV
38-
echo "version=$VERSION" >> $GITHUB_OUTPUT
39-
32+
4033
- name: Build and push Docker image
4134
uses: docker/build-push-action@v4
35+
env:
36+
TAG_NAME: ${{ github.ref && startsWith(github.ref, 'refs/tags/') && replace(replace(github.ref, 'refs/tags/', ''), 'v', '') || 'latest' }}
4237
with:
4338
context: .
4439
push: true
4540
platforms: linux/amd64,linux/arm64/v8
4641
tags: |
47-
ghcr.io/${{ github.repository_owner }}/etherproxy:${{ env.VERSION }}
42+
ghcr.io/${{ github.repository_owner }}/etherproxy:${{ env.TAG_NAME }}
4843
ghcr.io/${{ github.repository_owner }}/etherproxy:latest
4944
labels: |
50-
org.opencontainers.image.version=${{ env.VERSION }}
45+
org.opencontainers.image.version=${{ env.TAG_NAME }}
5146
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}

0 commit comments

Comments
 (0)