Skip to content

Commit

Permalink
Fix the github action
Browse files Browse the repository at this point in the history
  • Loading branch information
nodew committed Feb 12, 2024
1 parent 2716f52 commit ed0ade1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/assets-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ jobs:
- uses: actions/checkout@v3

- name: Extract Version
if: ${{ github.ref_type == 'tag' }}
if: ${{ runner.os == 'windows' }} && ${{ github.ref_type == 'tag' }}
working-directory: .
run: |
version=$(./build/extract_version "${GITHUB_REF#refs/tags/}")
$version = .\build\extract_version.ps1 "${GITHUB_REF#refs/tags/}"
echo "VERSION=$version" >> $Env:GITHUB_ENV
- name: Extract Version
if: ${{ runner.os != 'windows' }} && ${{ github.ref_type == 'tag' }}
working-directory: .
run: |
version=$(./build/extract_version.sh "${GITHUB_REF#refs/tags/}")
echo "VERSION=$version" >> $GITHUB_ENV
- name: Setup .NET
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nuget-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: ${{ github.ref_type == 'tag' }}
working-directory: .
run: |
version=$(./build/extract_version "${GITHUB_REF#refs/tags/}")
version=$(./build/extract_version.sh "${GITHUB_REF#refs/tags/}")
echo "VERSION=$version" >> $GITHUB_ENV
- name: Setup .NET
Expand Down
5 changes: 5 additions & 0 deletions build/extract_version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Use Select-Object and -match to extract version pattern
$version = $args[0] -match '(^[^-]+-)?v([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)$' | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Groups | Where-Object Name -eq '2'

# Output the extracted version
Write-Host $version
File renamed without changes.

0 comments on commit ed0ade1

Please sign in to comment.