-
-
Notifications
You must be signed in to change notification settings - Fork 18
54 lines (48 loc) · 1.87 KB
/
release.yml
File metadata and controls
54 lines (48 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 'Release'
on:
release:
types:
- published
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: GeoJSON.Text
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_VERSIONING_REGEX: "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z]+)?"
jobs:
deploy:
name: 'Deploy to Nuget'
if: github.event_name == 'release'
runs-on: windows-2019
steps:
- name: Validate release version
run: |
$VERSION=${env:GITHUB_REF_NAME}
if($VERSION[0] -eq "v"){
$VERSION=$VERSION.substring(1)
}
if(!($VERSION -match ${env:NUGET_VERSIONING_REGEX})) {
throw "Release tag did not contain a valid NUGET version. TAG was : ${env:GITHUB_REF_NAME}"
}
echo "Version to use is - $VERSION"
echo "RELEASE_VERSION=$VERSION" | Out-File -FilePath ${env:GITHUB_ENV} -Append
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
- name: Install dependencies
run: dotnet restore src/${{ env.PROJECT_NAME }}.sln
- name: Build solution
run: dotnet build src/${{ env.PROJECT_NAME }}.sln -c Release --no-restore
- name: Create Release NuGet package
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
- name: Push to Nuget
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