File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1515 # Official NuGet Feed settings
1616 NUGET_FEED : https://api.nuget.org/v3/index.json
1717 NUGET_KEY : ${{ secrets.NUGET_KEY }}
18+ NUGET_VERSIONING_REGEX : " [0-9]+\\ .[0-9]+\\ .[0-9]+-[a-zA-Z]+"
1819
1920jobs :
2021 deploy :
3738 run : dotnet build src/${{ env.PROJECT_NAME }}.sln -c Release --no-restore
3839 - name : Create Release NuGet package
3940 run : |
40- arrTag=(${GITHUB_REF//\// })
41- VERSION="${arrTag[2]}"
42- VERSION="${VERSION//v}"
43- dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.csproj
41+ $VERSION=${env:GITHUB_REF_NAME}
42+ if($VERSION[0] -eq "v"){
43+ $VERSION=$VERSION.substring(1)
44+ }
45+
46+ if(!($VERSION -match ${env:NUGET_VERSIONING_REGEX})) {
47+ throw "Release tag did not contain a valid NUGET version. TAG was : ${env:GITHUB_REF_NAME}"
48+ }
49+ dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj
4450 - name : Push to Nuget
4551 run : dotnet nuget push nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_KEY}} --skip-duplicate
You can’t perform that action at this time.
0 commit comments