Skip to content

Fix Nuget build script #60

Fix Nuget build script

Fix Nuget build script #60

Workflow file for this run

name: Build-Release
on:
push:
tags: v*
release:
types: [published]
jobs:
build:
runs-on: windows-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.100
- name: Build Version
# run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:11}) // deprecated
run: echo "RELEASE_VERSION=$($env:GITHUB_REF.SubString(11))" >> $env:GITHUB_ENV
- name: Build Project
run: dotnet build --configuration Release -p:Version=$env:RELEASE_VERSION
- name: Test Project
run: dotnet test --no-build --configuration Release --logger trx
- name: Pack Project
run: dotnet pack --no-build --output ./artifacts --configuration Release -p:Version=$env:RELEASE_VERSION
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: ./artifacts
publish-nuget:
if: github.event_name == 'release'
runs-on: windows-latest
needs: [ build ]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_APIKEY }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.100
source-url: https://api.nuget.org/v3/index.json
- uses: actions/download-artifact@v4
with:
name: artifacts
path: ./artifacts
- name: Upload to NuGet
run: dotnet nuget push ./artifacts/**/*.nupkg --skip-duplicate -n -k $env:NUGET_AUTH_TOKEN