Skip to content

Commit

Permalink
Add NuGet publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Nov 3, 2024
1 parent 3dc7e81 commit f8ba65f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Upload package to NuGet

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
build:
name: Upload package to NuGet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Build
run: |
dotnet build -c Release --no-restore /p:Version=${VERSION} /p:PackageVersion=${VERSION} LibSceSharp
dotnet build -c Release --no-restore /p:Version=${VERSION} /p:PackageVersion=${VERSION} LibSceSharp.Native
- name: Pack
run: |
dotnet pack -c Release /p:Version=${VERSION} --no-restore --no-build LibSceSharp
dotnet pack -c Release /p:Version=${VERSION} --no-restore --no-build LibSceSharp.Native
- name: Upload Packages
run: |
dotnet nuget push LibSceSharp/bin/Release/LibSceSharp.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN}
dotnet nuget push LibSceSharp.Native/bin/Release/LibSceSharp.Native.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN}
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

0 comments on commit f8ba65f

Please sign in to comment.