Skip to content

Commit a20c4d3

Browse files
committed
ci: use git describe for OCI image version label
1 parent 3e6252e commit a20c4d3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/dockerhub.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
uses: actions/checkout@v2
2828
with:
2929
fetch-depth: 0
30+
31+
- name: Retrieve version
32+
run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
3033

3134
- name: Get Docker tags
3235
id: docker_meta
@@ -39,6 +42,8 @@ jobs:
3942
type=semver,pattern={{version}}
4043
type=semver,pattern={{major}}.{{minor}}
4144
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
45+
labels: |
46+
org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
4247
4348
- name: Set up QEMU
4449
uses: docker/setup-qemu-action@v1
@@ -52,9 +57,6 @@ jobs:
5257
username: ${{ secrets.DOCKERHUB_USERNAME }}
5358
password: ${{ secrets.DOCKERHUB_TOKEN }}
5459

55-
- name: Retrieve version
56-
run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
57-
5860
- name: Build and push
5961
id: docker_build
6062
uses: docker/build-push-action@v2

0 commit comments

Comments
 (0)