Skip to content

Publish NuGet

Publish NuGet #3

Workflow file for this run

name: Publish NuGet
on:
workflow_dispatch:
release:
types: [published]
jobs:
publish-nuget:
permissions:
id-token: write
runs-on: ubuntu-latest
defaults:
run:
working-directory: InstantReplay.Externals
steps:
- name: NuGet OIDC login
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.CT_NUGET_USER }} # https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing
- uses: actions/checkout@v4
- name: get tag name
run: echo "VERSION=${GITHUB_REF_NAME##*v}" >> $GITHUB_ENV # v0.0.0 -> 0.0.0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build ./src/UniEnc/UniEnc.csproj -c Release -p:Version=${{ env.VERSION }} --no-restore -o ./publish
- name: Publish
run: dotnet nuget push ./publish/UniEnc*.${{ env.VERSION }}.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json