File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,16 @@ jobs:
3131 - name : Generate version property
3232 id : version
3333 run : |
34+ $pattern = '^v(((\d+\.\d+\.\d+\.\d+)(?:-[a-z]+\.\d+)?)-(\d+-g.+))'
3435 $tag = git.exe describe --tags --long
35- $version = [version]::new($tag.Split('-')[0].TrimStart('v'))
36+ $version = [System.Text.RegularExpressions.Regex]::Match($tag, $pattern).Groups[3].Value
37+ $fullVersion = [System.Text.RegularExpressions.Regex]::Match($tag, $pattern).Groups[2].Value
38+ $gitCommitInfo = [System.Text.RegularExpressions.Regex]::Match($tag, $pattern).Groups[4].Value
39+ $informationalVersion = '{0}+{1}' -f $fullVersion,$gitCommitInfo
3640
3741 echo "version=$version" >> $env:GITHUB_OUTPUT
42+ echo "fullVersion=$fullVersion" >> $env:GITHUB_OUTPUT
43+ echo "informationalVersion=$informationalVersion" >> $env:GITHUB_OUTPUT
3844
3945 - name : Run tests
4046 run : dotnet.exe test .\src\PSDataProtection.sln --configuration Release --runtime win-x64
@@ -100,7 +106,7 @@ jobs:
100106
101107 - name : Publish release
102108 if : github.ref_type == 'tag'
103- run : gh.exe release create v${{ steps.version.outputs.version }} --title v${{ steps.version.outputs.version }} --notes 'PowerShell data protection module.' ps-data-protection.msi
109+ run : gh.exe release create v${{ steps.version.outputs.fullVersion }} --title v${{ steps.version.outputs.fullVersion }} --notes 'PowerShell data protection module.' ps-data-protection.msi
104110 env :
105111 # Requires a personal access token with a fine-grained permission of contents:read/write.
106112 GH_TOKEN : ${{ secrets.MY_GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 2727 </ItemGroup >
2828
2929 <Target Name =" GetVersionFromGit" >
30- <Exec Command =" git.exe describe --tags --long" WorkingDirectory =" $(MSBuildProjectDirectory)" ConsoleToMSBuild =" true" StandardOutputImportance =" Low" >
30+ <Exec Command =" git.exe describe --tags --long" WorkingDirectory =" $(MSBuildProjectDirectory)" ConsoleToMsBuild =" true" StandardOutputImportance =" Low" >
3131 <Output TaskParameter =" ConsoleOutput" PropertyName =" GitTag" />
3232 </Exec >
3333
3434 <PropertyGroup >
35- <PatternGitTag >^v((.+)-(\d+)-g(.+))</PatternGitTag >
36- <AssemblyVersion >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value)</AssemblyVersion >
37- <FileVersion >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value)</FileVersion >
38- <Version >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value)</Version >
39- <InformationalVersion >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[1].Value)</InformationalVersion >
35+ <PatternGitTag >^v(((\d+\.\d+\.\d+\.\d+)(?:-[a-z]+\.\d+)?)-(\d+-g.+))</PatternGitTag >
36+ <AssemblyVersion >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[3].Value)</AssemblyVersion >
37+ <FileVersion >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[3].Value)</FileVersion >
38+ <Version >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[3].Value)</Version >
39+ <FullVersion >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value)</FullVersion >
40+ <GitCommitInfo >$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[4].Value)</GitCommitInfo >
41+ <InformationalVersion >$(FullVersion)+$(GitCommitInfo)</InformationalVersion >
4042 </PropertyGroup >
4143
4244 <Message Text =" *** InformationalVersion $(InformationalVersion)" Importance =" high" />
You can’t perform that action at this time.
0 commit comments