@@ -6,16 +6,34 @@ outputs:
66runs :
77 using : ' composite'
88 steps :
9- - name : Generate/Set Version 🏷️
9+ - name : Generate Version 🏷️
1010 id : version
1111 shell : pwsh
1212 run : |
13- $LATEST_TAG = git describe --tags --abbrev=0 # Get the latest tag name
14- $COMMIT_COUNT = git rev-list --use-bitmap-index --count "$(git rev-list --tags --no-walk --max-count=1)..HEAD" # Count all commits since the last tag
15- $NIXOS_WSL_VERSION = "$($LATEST_TAG -replace '(.+)\.(.+)\.(.+)\..+', '$1.$2.$3').${COMMIT_COUNT}" # Compose the NixOS-WSL version number
16- Write-Output "version=${NIXOS_WSL_VERSION}" >> $env:GITHUB_OUTPUT
13+ if ('${{ github.event_name }}' -eq 'pull_request') {
14+ $version = 'pr-${{ github.event.pull_request.number }}'
15+ $is_numeric = ''
16+ } elseif ($refName -like 'release-*') {
17+ $latest_tag = git describe --tags --abbrev=0
18+ $commit_count = git rev-list --use-bitmap-index --count "$(git rev-list --tags --no-walk --max-count=1)..HEAD"
19+ $version = "$($latest_tag -replace '(.+)\.(.+)\.(.+)\..+', '$1.$2.$3').${commit_count}"
20+ $is_numeric = 1
21+ } else {
22+ $version = '${{ github.ref_name }}'
23+ $is_numeric = ''
24+ }
25+ "version=$version" | Tee-Object -FilePath $env:GITHUB_OUTPUT -Append
26+ "is_numeric=$is_numeric" | Tee-Object -FilePath $env:GITHUB_OUTPUT -Append
1727
18- Write-Output $NIXOS_WSL_VERSION > ./VERSION
19- Write-Output $(git rev-parse HEAD) >> ./VERSION
20- ((Get-Content -path ./Launcher/Launcher/Launcher.csproj -Raw) -replace '1.3.3.7',$NIXOS_WSL_VERSION) | Set-Content -Path ./Launcher/Launcher/Launcher.csproj
21- ((Get-Content -path ./Launcher/Launcher-Appx/Package.appxmanifest -Raw) -replace '1.3.3.7',$NIXOS_WSL_VERSION) | Set-Content -Path ./Launcher/Launcher-Appx/Package.appxmanifest
28+ - name : Set Version 🏷️
29+ shell : pwsh
30+ run : |
31+ Write-Output '${{ steps.version.outputs.version }}' | Tee-Object -FilePath ./VERSION
32+ Write-Output "$(git rev-parse HEAD)" | Tee-Object -FilePath ./VERSION -Append
33+
34+ - name : Set Launcher Version 🏷️
35+ shell : pwsh
36+ if : ${{ steps.version.outputs.is_numeric }}
37+ run : |
38+ ((Get-Content -path ./Launcher/Launcher/Launcher.csproj -Raw) -replace '1.3.3.7','${{ steps.version.outputs.version }}') | Set-Content -Path ./Launcher/Launcher/Launcher.csproj
39+ ((Get-Content -path ./Launcher/Launcher-Appx/Package.appxmanifest -Raw) -replace '1.3.3.7','${{ steps.version.outputs.version }}') | Set-Content -Path ./Launcher/Launcher-Appx/Package.appxmanifest
0 commit comments