From 762b472a196059c1db24c91818301a30c1359887 Mon Sep 17 00:00:00 2001 From: "Jens A. Koch" Date: Thu, 6 Feb 2025 00:30:05 +0100 Subject: [PATCH] check if tag already exists, before gh release create --- .github/workflows/build-mesa.yml | 16 ++++++++++------ .github/workflows/build-swiftshader.yml | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-mesa.yml b/.github/workflows/build-mesa.yml index f7acaf9..1095da5 100644 --- a/.github/workflows/build-mesa.yml +++ b/.github/workflows/build-mesa.yml @@ -301,22 +301,26 @@ jobs: retention-days: 3 # This is a date based version for repeatable releases (date.run.run_attempt). - - name: Set Rolling Release Version for Tag + - name: 🏷️ Set Rolling Release Version for Tag shell: pwsh run: | echo "RELEASE_VERSION_TAG=$(Get-Date -Format 'yyyyMMdd').${{ github.run_number }}.${{ github.run_attempt }}" >> $env:GITHUB_ENV - Write-Output "RELEASE_VERSION_TAG: $Env:RELEASE_VERSION_TAG" + # Step 1: Create a new release tag, if not exists. - name: 📦 🚀 Create Release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: pwsh run: | - gh release create "${{ env.RELEASE_VERSION_TAG }}" ` - --title "${{ env.MESA_LVP_ARTIFACT_NAME }}" ` - --notes "Mesa Lavapipe for Windows (x64, VC17) ${{ env.MESA_LVP_VERSION }}" ` - --latest + if (-not (gh release view "${{ env.RELEASE_VERSION_TAG }}" *> $null)) { + gh release create "${{ env.RELEASE_VERSION_TAG }}" ` + --title "${{ env.MESA_LVP_ARTIFACT_NAME }}" ` + --notes "Mesa Lavapipe for Windows (x64, VC17) ${{ env.MESA_LVP_VERSION }}" ` + --latest + } else { + echo "✅ Release ${{ env.RELEASE_VERSION_TAG }} already exists. Skipping creation." + } # Step 2: Upload the artifact to the release tag. - name: 📦 🔼 Upload Release Artifact diff --git a/.github/workflows/build-swiftshader.yml b/.github/workflows/build-swiftshader.yml index 895885e..0d0e0f3 100644 --- a/.github/workflows/build-swiftshader.yml +++ b/.github/workflows/build-swiftshader.yml @@ -145,23 +145,28 @@ jobs: retention-days: 3 # This is a date based version for repeatable releases (date.run.run_attempt). - - name: Set Rolling Release Version for Tag + - name: 🏷️ Set Rolling Release Version for Tag shell: pwsh run: | echo "RELEASE_VERSION_TAG=$(Get-Date -Format 'yyyyMMdd').${{ github.run_number }}.${{ github.run_attempt }}" >> $env:GITHUB_ENV - Write-Output "RELEASE_VERSION_TAG: $Env:RELEASE_VERSION_TAG" + # Step 1: Create a new release tag, if not exists. - name: 📦 🚀 Create Release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: pwsh run: | - gh release create "${{ env.RELEASE_VERSION_TAG }}" ` - --title "${{ env.SWIFTSHADER_ARTIFACT_NAME }}" ` - --notes "Swiftshader for Windows (x64, VC17) ${{ env.SWIFTSHADER_VERSION }}" ` - --latest - + if (-not (gh release view "${{ env.RELEASE_VERSION_TAG }}" *> $null)) { + gh release create "${{ env.RELEASE_VERSION_TAG }}" ` + --title "${{ env.SWIFTSHADER_ARTIFACT_NAME }}" ` + --notes "Swiftshader for Windows (x64, VC17) ${{ env.SWIFTSHADER_VERSION }}" ` + --latest + } else { + echo "✅ Release ${{ env.RELEASE_VERSION_TAG }} already exists. Skipping creation." + } + + # Step 2: Upload the artifact to the release tag. - name: 📦 🔼 Upload Release Artifact if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: