Skip to content

Commit

Permalink
Merge pull request #32 from Bardin08/vbardin/setup-github-actions
Browse files Browse the repository at this point in the history
Add NuGet Publish workflow
  • Loading branch information
Bardin08 authored Mar 12, 2024
2 parents 1ef2c9b + 62e31aa commit fa58740
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/nuget-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Publish NuGet

on:
release:
types: [created]
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Extract release version
id: release_version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --no-restore --verbosity normal

- name: Pack
run: dotnet pack --configuration Release --no-build --output nupkgs /p:PackageVersion=${{ env.RELEASE_VERSION }}

- name: Push to NuGet
run: dotnet nuget push "nupkgs/**/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 comments on commit fa58740

Please sign in to comment.