From fb1a0b919cf6c5be0cfa6680223db7dd588b6f5c Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 30 Jul 2024 21:33:30 -0500 Subject: [PATCH] Update pre-release.yaml bug fix and error handling --- .github/workflows/pre-release.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index 34e04d32..2b8835a7 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -14,11 +14,11 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Extract Version from winutil.ps1 + - name: Set Version to Todays Date id: extract_version run: | $version = (Get-Date -Format "yy.MM.dd") - echo "version=$version" >> $env:GITHUB_ENV + echo "VERSION=$version" >> $env:GITHUB_ENV shell: pwsh - name: Create Tag @@ -27,7 +27,15 @@ jobs: $tagExists = git tag -l $env:VERSION if ($tagExists -eq "") { git tag $env:VERSION + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to create tag $env:VERSION" + exit 1 + } git push origin $env:VERSION + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to push tag $env:VERSION" + exit 1 + } } else { Write-Host "Tag $env:VERSION already exists, skipping tag creation" } @@ -45,4 +53,4 @@ jobs: prerelease: true generate_release_notes: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file