From 063c7d5afe6a706fa6b5f3e6ffbe9c8c3ca85e7e Mon Sep 17 00:00:00 2001 From: Audionut Date: Thu, 19 Dec 2024 18:17:58 +1000 Subject: [PATCH] Change docker to release version instead --- .github/workflows/docker-image.yml | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index aa49b2e40..d6f403411 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,10 +1,9 @@ name: Create and publish Docker images on: - push: - branches: - - master - - development + release: + types: + - published workflow_dispatch: env: @@ -43,30 +42,19 @@ jobs: run: | REPO_NAME=${{ env.IMAGE_NAME }} echo "LOWER_CASE_REPO_NAME=${REPO_NAME,,}" >> $GITHUB_ENV - - - name: Get short commit id - id: get_short_commit_id - run: | - echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: Set image name based on branch - id: set_image_name + - name: Get release version + id: get_release_version run: | - if [ "${{ github.ref_name }}" == "master" ]; then - IMAGE_TAG="master" - elif [ "${{ github.ref_name }}" == "develop" ]; then - IMAGE_TAG="develop" - else - IMAGE_TAG="${{ github.ref_name }}" - fi - echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV - + RELEASE_VERSION=${{ github.event.release.tag_name }} + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV + - name: Build and push Docker image uses: docker/build-push-action@v3 with: context: . push: true - tags: ${{ env.REGISTRY }}/${{ env.LOWER_CASE_REPO_NAME }}:${{ env.IMAGE_TAG }}, ${{ steps.meta.outputs.tags }} + tags: ${{ env.REGISTRY }}/${{ env.LOWER_CASE_REPO_NAME }}:${{ env.RELEASE_VERSION }}, ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max \ No newline at end of file