Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing workflow #3

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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