Skip to content

Commit

Permalink
Adding release action
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-lethargic committed Jul 12, 2024
1 parent 62e6ea8 commit bae25e5
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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

0 comments on commit bae25e5

Please sign in to comment.