Skip to content

Commit

Permalink
Created publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
VasilijP authored Oct 17, 2024
1 parent 7e2aa9e commit 518b796
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish NuGet Package

on:
push:
tags:
- 'v*' # Triggers on tags starting with 'v', e.g., 'v1.0.0'
branches:
- main # Ensures it's on the 'main' branch

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install dependencies
run: dotnet restore

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

- name: Pack NuGet package
run: |
dotnet pack --configuration Release --no-build --output ./artifacts
env:
NUGET_PACKAGE_VERSION: ${{ github.ref_name }}

- name: Publish NuGet package
run: |
dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 comments on commit 518b796

Please sign in to comment.