Skip to content

Commit 55cc641

Browse files
authored
update GitHub Actions workflow to use Docker metadata for tagging (#117)
1 parent 9bade6e commit 55cc641

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/workflows/publish_latest.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,21 @@ jobs:
1212
- name: Clone Action Repository
1313
uses: actions/checkout@v4
1414

15-
- name: Get Short Commit Hash
16-
id: vars
17-
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
15+
- name: Get Docker Metadata
16+
id: meta
17+
uses: docker/metadata-action@v4
18+
with:
19+
images: |
20+
${{ github.repository }}
21+
tags: |
22+
type=raw,value=latest
23+
type=raw,value=release
24+
type=ref,event=branch
25+
type=ref,event=release
26+
type=semver,pattern={{major}}
27+
type=semver,pattern={{major}}.{{minor}}
28+
type=semver,pattern={{version}}
29+
type=sha
1830
1931
- name: Login to Docker Hub
2032
uses: docker/login-action@v3
@@ -26,9 +38,6 @@ jobs:
2638
uses: docker/build-push-action@v4
2739
with:
2840
context: .
29-
tags: |
30-
${{ github.repository_owner }}/${{ github.repository }}:${{ github.release.tag_name }}
31-
${{ github.repository_owner }}/${{ github.repository }}:latest
32-
${{ github.repository_owner }}/${{ github.repository }}:release
33-
${{ github.repository_owner }}/${{ github.repository }}:${{ env.COMMIT_HASH }}
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}
3443
push: true

0 commit comments

Comments
 (0)