1.4.1 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Net | |
# 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 | |
8.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 |