Skip to content

Publish on NuGet

Publish on NuGet #14

Workflow file for this run

# This is a manually triggered nuget build and deploy
name: Publish on NuGet
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Package Version"
# Default value if no value is explicitly provided
default: "1.5.0"
# Input has to be provided for the workflow to run
required: true
jobs:
build:
name: Update NuGet package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore ./src/template
- name: Build
run: dotnet build ./src/template --no-restore
- name: Test
run: dotnet test ./src/template --no-build --verbosity normal
- name: Pack
run: nuget pack ./src/Package.Template.nuspec -NoDefaultExcludes -OutputDirectory ./out -Version ${{ github.event.inputs.version }}
- name: Push package to Nuget
run: dotnet nuget push ./out/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols