From 929c95f9aef26235e38c5453e457bd94ce131faa Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Tue, 24 Aug 2021 21:00:13 +0200 Subject: [PATCH] fix version in docker builds --- .github/workflows/docker-publish.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 5f63d44..dcdec0d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -26,6 +26,13 @@ jobs: - name: Check out the repo uses: actions/checkout@v2 + - name: Get Version + shell: bash + run: | + echo "::set-output name=identifier::$(echo ${GITHUB_REF##*/})" + echo "::set-output name=hash::$(echo ${GITHUB_SHA} | cut -c1-7)" + id: get_version + - name: Log in to Docker Hub if: github.event_name != 'pull_request' uses: docker/login-action@v1 @@ -55,8 +62,8 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - BUILD_IDENTIFIER=${GITHUB_REF##*/} - BUILD_VERSION=$(echo ${GITHUB_SHA} | cut -c1-7) + BUILD_IDENTIFIER=${{ steps.get_version.outputs.identifier }} + BUILD_VERSION=${{ steps.get_version.outputs.hash }} build-github: name: Push Docker image to Github Container Registry @@ -69,6 +76,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Get Version + shell: bash + run: | + echo "::set-output name=identifier::$(echo ${GITHUB_REF##*/})" + echo "::set-output name=hash::$(echo ${GITHUB_SHA} | cut -c1-7)" + id: get_version + # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} @@ -105,5 +119,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - BUILD_IDENTIFIER=${GITHUB_REF##*/} - BUILD_VERSION=$(echo ${GITHUB_SHA} | cut -c1-7) \ No newline at end of file + BUILD_IDENTIFIER=${{ steps.get_version.outputs.identifier }} + BUILD_VERSION=${{ steps.get_version.outputs.hash }} \ No newline at end of file