From 84c7dc3bb3e99dd02d5244fb9cf7a9e34a4fc5d2 Mon Sep 17 00:00:00 2001 From: Andrew Pelletier Date: Thu, 1 Feb 2024 15:51:47 -0500 Subject: [PATCH] try to create tag and image name once --- .github/workflows/webhook.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index 6a91c8b..f4d078f 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -58,19 +58,20 @@ jobs: packages: write # push docker images steps: - uses: actions/checkout@v4 - - run: echo "VERSION=$(cat version.txt)" >> "$GITHUB_OUTPUT" - id: version-selector + - run: | + echo "VERSION=$(cat version.txt)" >> "$GITHUB_OUTPUT" + echo "TAG_NAME=${{ env.GIT_TAG_PREFIX }}${{ steps.naming-selector.outputs.VERSION }}" >> "$GITHUB_OUTPUT" + echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.naming-selector.outputs.VERSION }}" >> "$GITHUB_OUTPUT" + id: naming-selector name: generate image name - run: | - IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version-selector.outputs.VERSION }} - ! docker manifest inspect $IMAGE_NAME + ! docker manifest inspect ${{ steps.naming-selector.outputs.IMAGE_NAME }} name: confirm image is not already pushed - run: | - TAG_NAME=${{ env.GIT_TAG_PREFIX }}${{ steps.version-selector.outputs.VERSION }} git fetch --tags - ! git rev-parse -q --verify "refs/tags/$TAG_NAME" + ! git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}" name: confirm git tag does not exist - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 @@ -83,12 +84,12 @@ jobs: # with: # context: ${{ env.WORKING_DIR }} # push: true -# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version-selector.outputs.VERSION }} +# tags: ${{ steps.naming-selector.outputs.IMAGE_NAME }} - uses: mathieudutour/github-tag-action@v6.1 id: tag_version with: - custom_tag: ${{ env.GIT_TAG_PREFIX }}${{ steps.version-selector.outputs.VERSION }} + custom_tag: ${{ steps.naming-selector.outputs.TAG_NAME }} github_token: ${{ secrets.GITHUB_TOKEN }} - uses: ncipollo/release-action@v1