Skip to content

Commit

Permalink
Fix/hotfix version calculation (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
anaiberta authored Oct 17, 2023
1 parent d43e141 commit 7c5d22b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
12 changes: 0 additions & 12 deletions .github/generatePackageVersion.ps1

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:

- name: Calculate environment variables
id: buildVariables
env:
PackageVersionString: ./.github/generatePackageVersion.ps1
run: |
$IsMaster = $false
switch -regex ($Env:GIT_REF) {
Expand All @@ -62,15 +60,17 @@ jobs:
$COMMIT_MESSAGE = $(git log -1 --pretty=%B)
$LAST_COMMITTER = $(git log -1 --pretty=format:%an)
$NUGET_PACKAGE_VERSION = & "$Env:PackageVersionString"
$GetFileVersionOutput = dotnet msbuild ./Directory.Build.props /t:GetFileVersionForPackage /p:COMMIT_NUMBER=$COMMIT_NUMBER /p:VersionSuffix="" /p:UseDefaultSuffix=false
"$GetFileVersionOutput" -match "(?<=FileVersion:)(.*)" > $null
$NUGET_PACKAGE_VERSION = $Matches[0]
if ($IsPrerelease -eq $true) {
$VersionTag = @("trunk", "stable")[$IsMaster]
$Timestamp = (Get-Date -AsUTC).ToString("yyyyMMddHHmmss")
$NUGET_PACKAGE_VERSION = $NUGET_PACKAGE_VERSION + "-" + $VersionTag + "." + $Timestamp
}
Write-Output "Packge version to be used: $NUGET_PACKAGE_VERSION"
Write-Output "Package version to be used: $NUGET_PACKAGE_VERSION"
echo "NUGET_PACKAGE_VERSION=$NUGET_PACKAGE_VERSION" >> $env:GITHUB_ENV
echo "IsPrerelease=$IsPrerelease" >> $env:GITHUB_ENV
echo "NUGET_PACKAGE_VERSION=$NUGET_PACKAGE_VERSION" >> $env:GITHUB_OUTPUT
Expand Down

0 comments on commit 7c5d22b

Please sign in to comment.