1+ name : Build and Publish VRChat Realtime SDK
2+
13on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - ' wrapper/VRChat.API.Realtime/**'
9+ - ' .github/workflows/realtime-ci.yml'
210 workflow_dispatch :
311
4- name : Build and Publish VRChat Realtime SDK
5-
612jobs :
7- generate :
13+ build-and-publish :
814 runs-on : ubuntu-latest
915 name : Build and Publish VRChat Realtime SDK
1016 steps :
11- - name : Setup NuGet
12- 17+ - name : Checkout current commit
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0 # Fetch all history to compare versions
1321
14- - uses : actions/setup-dotnet@v5
22+ - name : Setup .NET
23+ uses : actions/setup-dotnet@v5
1524 with :
1625 dotnet-version : ' 8.0.x'
1726
18- - name : Publish to VRChat.API.Realtime to NuGet
27+ - name : Setup NuGet
28+ 29+
30+ - name : Get current version from csproj
31+ id : current_version
32+ run : |
33+ VERSION=$(grep -oP '(?<=<Version>)[^<]+' wrapper/VRChat.API.Realtime/VRChat.API.Realtime.csproj)
34+ echo "version=$VERSION" >> $GITHUB_OUTPUT
35+ echo "Current version: $VERSION"
36+
37+ - name : Get previous version from NuGet
38+ id : nuget_version
39+ run : |
40+ # Try to get the latest version from NuGet
41+ NUGET_VERSION=$(curl -s "https://api.nuget.org/v3-flatcontainer/vrchat.api.realtime/index.json" | jq -r '.versions[-1]' 2>/dev/null || echo "0.0.0")
42+ if [ "$NUGET_VERSION" = "null" ] || [ -z "$NUGET_VERSION" ]; then
43+ NUGET_VERSION="0.0.0"
44+ fi
45+ echo "version=$NUGET_VERSION" >> $GITHUB_OUTPUT
46+ echo "Latest NuGet version: $NUGET_VERSION"
47+
48+ - name : Check if version changed
49+ id : version_check
50+ run : |
51+ CURRENT="${{ steps.current_version.outputs.version }}"
52+ NUGET="${{ steps.nuget_version.outputs.version }}"
53+
54+ echo "Current version: $CURRENT"
55+ echo "NuGet version: $NUGET"
56+
57+ if [ "$CURRENT" != "$NUGET" ]; then
58+ echo "Version changed from $NUGET to $CURRENT"
59+ echo "changed=true" >> $GITHUB_OUTPUT
60+ else
61+ echo "Version unchanged ($CURRENT)"
62+ echo "changed=false" >> $GITHUB_OUTPUT
63+ fi
64+
65+ - name : Build project
66+ run : dotnet build wrapper/VRChat.API.Realtime/VRChat.API.Realtime.csproj --configuration Release
67+
68+ - name : Publish to NuGet
69+ if : steps.version_check.outputs.changed == 'true'
19702071 with :
21- # Filepath of the project to be packaged, relative to root of repository
2272 PROJECT_FILE_PATH : wrapper/VRChat.API.Realtime/VRChat.API.Realtime.csproj
23- # NuGet package id, used for version detection & defaults to project name
2473 PACKAGE_NAME : VRChat.API.Realtime
25- # API key to authenticate with NuGet server
26- NUGET_KEY : ${{secrets.NUGET_KEY}}
27- # NuGet server uri hosting the packages, defaults to https://api.nuget.org
28- # NUGET_SOURCE: https://api.nuget.org
29- # Flag to toggle pushing symbols along with nuget package to the server, disabled by default
74+ NUGET_KEY : ${{ secrets.NUGET_KEY }}
3075 INCLUDE_SYMBOLS : true
0 commit comments