Skip to content

Merge pull request #15 from shahabfar/release #27

Merge pull request #15 from shahabfar/release

Merge pull request #15 from shahabfar/release #27

Workflow file for this run

name: Publish to NuGet
on:
push:
branches: [ "master" ]
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- 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: Set version
id: version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=1.0.0
fi
echo "::set-output name=version::$VERSION"
- name: Pack
run: dotnet pack --no-build --configuration Release /p:PackageVersion=${{ steps.version.outputs.version }} --output out
- name: Push
run: dotnet nuget push "out/*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json