Skip to content

Commit

Permalink
Merge pull request #3 from thetestgame/jmaxwell/automatic-nuget-packages
Browse files Browse the repository at this point in the history
Add testing workflow
  • Loading branch information
thetestgame authored Nov 29, 2024
2 parents 19ccaa9 + 700f894 commit 0281066
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Publish Steamworks.NET NuGet Package
on:
push:
tags:
- '*'

jobs:
build-and-publish:
name: Build and Publish NuGet Package
runs-on: windows-latest

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Setup .NET environment
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x'

# Setup NuGet client
- name: Setup NuGet client
run: |
choco install nuget -y
nuget update -self
# Extract the version from the tag
- name: Extract version from tag
id: get_version
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"

# Build binaries
- name: Build and Package binaries
run: |
$version="${{ steps.get_version.outputs.version }}"
(Get-Content Steamworks.NET.nuspec) -replace '<version>.*?</version>', "<version>$version</version>" | Set-Content Standalone/Steamworks.NET.nuspec
dotnet build -t:BatchBuild Standalone/Steamworks.NET.Standard.sln
nuget pack Standalone/Steamworks.NET.nuspec -OutputDirectory bin\
# Publish the NuGet package
- name: Publish to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
nuget push bin\*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey $NUGET_API_KEY

0 comments on commit 0281066

Please sign in to comment.