-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub workflow for NuGet publish (#46)
- Loading branch information
Showing
4 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish NuGet Packages | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+-*' | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build and Publish NuGet | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 9.0 | ||
- name: Extract Version from Tag | ||
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
- name: Install Dependencies | ||
run: dotnet restore | ||
- name: Build Solution | ||
run: | | ||
dotnet build --configuration Release \ | ||
--no-restore \ | ||
-p:CI_BUILD=true \ | ||
-p:Version=${{env.VERSION}} \ | ||
-p:PackageVersion=${{env.VERSION}} \ | ||
- name: Pack NuGet Packages | ||
run: | | ||
dotnet pack --configuration Release \ | ||
--no-build \ | ||
-p:CI_BUILD=true \ | ||
-p:Version=${{env.VERSION}} \ | ||
-p:PackageVersion=${{env.VERSION}} \ | ||
--output ./artifacts | ||
- name: Publish to NuGet | ||
env: | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_API_KEY |
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
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
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