mirror of
https://github.com/sochix/TLSharp.git
synced 2026-04-03 03:57:16 +02:00
nugetUpload: honor git tags as versions
This commit is contained in:
parent
ba0715ed5e
commit
c59eba9023
16
.github/workflows/nugetUpload.yml
vendored
16
.github/workflows/nugetUpload.yml
vendored
|
|
@ -23,10 +23,18 @@ jobs:
|
||||||
$date = get-date -format "yyyyMMdd-HHmm"
|
$date = get-date -format "yyyyMMdd-HHmm"
|
||||||
$hash = & git rev-parse --short HEAD
|
$hash = & git rev-parse --short HEAD
|
||||||
|
|
||||||
$baseVersion = "0.0.1"
|
$tagPrefix = "refs/tags/"
|
||||||
$version = "$baseVersion-date.$date.git.$hash"
|
If ($Env:GITHUB_REF.StartsWith($tagPrefix)) {
|
||||||
|
$version = $Env:GITHUB_REF.Substring($tagPrefix.Length)
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$baseVersion = "0.1.0"
|
||||||
|
$version = "$baseVersion-date.$date.git.$hash"
|
||||||
|
}
|
||||||
|
|
||||||
./Nuget.exe pack src/TgSharp.Core/TgSharp.Core.csproj -Version $version -Build -Properties Configuration=Release
|
./Nuget.exe pack src/TgSharp.Core/TgSharp.Core.csproj -Version $version -Build -Properties Configuration=Release
|
||||||
If ($Env:GITHUB_REF -eq 'refs/heads/master' -AND '${{ secrets.NUGET_API_KEY }}' -ne '') {
|
If ($Env:GITHUB_REF -eq 'refs/heads/master' -OR $Env:GITHUB_REF.StartsWith($tagPrefix)) {
|
||||||
./Nuget.exe push "TgSharp.$version.nupkg" ${{secrets.NUGET_API_KEY}} -Source https://api.nuget.org/v3/index.json
|
If ('${{ secrets.NUGET_API_KEY }}' -ne '') {
|
||||||
|
./Nuget.exe push "TgSharp.$version.nupkg" ${{secrets.NUGET_API_KEY}} -Source https://api.nuget.org/v3/index.json
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue