Skip to content

Commit 8824a55

Browse files
Merge pull request #8 from GeoJSON-Net/feature/update-release-script
Updated the release action
2 parents 3feb5b3 + aaefb08 commit 8824a55

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
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

1920
jobs:
2021
deploy:
@@ -37,9 +38,14 @@ jobs:
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

0 commit comments

Comments
 (0)