From 33483aa6a2f098f68f52241305f684c5fc85bc2f Mon Sep 17 00:00:00 2001 From: jklingen Date: Mon, 21 Apr 2025 18:42:14 +0200 Subject: [PATCH] Extract version in pwsh --- .github/workflows/release.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 237b37bf0..659d53f00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,11 +62,16 @@ jobs: Picasa_ClientId: ${{ secrets.Picasa_ClientId }} Picasa_ClientSecret: ${{ secrets.Picasa_ClientSecret }} - - name: Extract version + - name: Extract version from file name + id: extract_version run: | - FILE_NAME=$(ls Greenshot-INSTALLER-*.exe | head -n 1) - VERSION=$(echo "$FILE_NAME" | sed -E 's/Greenshot-INSTALLER-([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/') - echo "VERSION=$VERSION" >> $GITHUB_ENV + $file = Get-ChildItem drop -Filter "Greenshot-INSTALLER-*.exe" | Select-Object -First 1 + if ($file -match "Greenshot-INSTALLER-([\d\.]+).*\.exe") { + echo "VERSION=$($matches[1])" >> $GITHUB_ENV + } else { + throw "Version number could not be extracted from file name: $file" + } + shell: pwsh - name: Create tag