Skip to content

Commit

Permalink
ci: use git describe for OCI image version label
Browse files Browse the repository at this point in the history
  • Loading branch information
buchdag committed Jan 14, 2022
1 parent 8b3f38a commit cf48957
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Retrieve version
run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV

- name: Get Docker tags for Alpine based image
if: ${{ matrix.base == 'alpine' }}
Expand All @@ -42,6 +45,8 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
labels: |
org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
- name: Get Docker tags for Debian based image
if: ${{ matrix.base == 'debian' }}
Expand All @@ -55,11 +60,10 @@ jobs:
type=semver,suffix=-debian,pattern={{version}}
type=semver,suffix=-debian,pattern={{major}}.{{minor}}
type=raw,value=debian,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
labels: |
org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
flavor: latest=false

- name: Retrieve version
run: echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

Expand All @@ -77,7 +81,7 @@ jobs:
id: docker_build_alpine
uses: docker/build-push-action@v2
with:
build-args: VERSION=${{ env.VERSION }}
build-args: VERSION=${{ env.GIT_DESCRIBE }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.docker_meta_alpine.outputs.tags }}
Expand All @@ -88,7 +92,7 @@ jobs:
id: docker_build_debian
uses: docker/build-push-action@v2
with:
build-args: VERSION=${{ env.VERSION }}
build-args: VERSION=${{ env.GIT_DESCRIBE }}
file: Dockerfile.debian
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
Expand Down

0 comments on commit cf48957

Please sign in to comment.