Skip to content

Commit bae25e5

Browse files
author
Matt Hunt
committed
Adding release action
1 parent 62e6ea8 commit bae25e5

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Release'
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
10+
DOTNET_CLI_TELEMETRY_OPTOUT: true
11+
12+
# Project name to pack and publish
13+
PROJECT_NAME: GeoJSON.Net
14+
15+
# Official NuGet Feed settings
16+
NUGET_FEED: https://api.nuget.org/v3/index.json
17+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
18+
NUGET_VERSIONING_REGEX: "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z]+)?"
19+
20+
jobs:
21+
deploy:
22+
name: 'Deploy to Nuget'
23+
if: github.event_name == 'release'
24+
runs-on: windows-2019
25+
26+
steps:
27+
- name: Validate release version
28+
run: |
29+
$VERSION=${env:GITHUB_REF_NAME}
30+
if($VERSION[0] -eq "v"){
31+
$VERSION=$VERSION.substring(1)
32+
}
33+
if(!($VERSION -match ${env:NUGET_VERSIONING_REGEX})) {
34+
throw "Release tag did not contain a valid NUGET version. TAG was : ${env:GITHUB_REF_NAME}"
35+
}
36+
echo "Version to use is - $VERSION"
37+
echo "RELEASE_VERSION=$VERSION" | Out-File -FilePath ${env:GITHUB_ENV} -Append
38+
- uses: actions/checkout@v2
39+
- name: Setup .NET Core
40+
uses: actions/setup-dotnet@v1
41+
with:
42+
dotnet-version: |
43+
3.1.x
44+
5.0.x
45+
6.0.x
46+
7.0.x
47+
8.0.x
48+
- name: Install dependencies
49+
run: dotnet restore src/${{ env.PROJECT_NAME }}.sln
50+
- name: Build solution
51+
run: dotnet build src/${{ env.PROJECT_NAME }}.sln -c Release --no-restore
52+
- name: Create Release NuGet package
53+
run: dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=${{ env.RELEASE_VERSION }} -o nupkg src/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj
54+
- name: Push to Nuget
55+
run: dotnet nuget push "./nupkg/${{ env.PROJECT_NAME }}.${{ env.RELEASE_VERSION }}.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_KEY}} --skip-duplicate

0 commit comments

Comments
 (0)