Skip to content

Commit 4279e02

Browse files
committed
ci: publish from the ci workflow
1 parent c7bc571 commit 4279e02

2 files changed

Lines changed: 78 additions & 99 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ on:
33
branches:
44
- '**'
55
pull_request:
6+
repository_dispatch:
7+
types: [release]
8+
workflow_dispatch:
9+
inputs:
10+
json:
11+
description: Passed json from repository_dispatch
12+
required: true
13+
type: string
14+
version_postfix:
15+
description: Additional string to concatenate onto the existing version before release
16+
required: false
17+
type: string
18+
default: ''
619
workflow_call:
720
inputs:
821
ref:
@@ -13,9 +26,15 @@ on:
1326

1427
name: CI
1528

29+
env:
30+
PASSED_VERSION: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json || '{}'))['version'] }}
31+
VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }}
32+
1633
jobs:
1734
generate:
1835
runs-on: ubuntu-latest
36+
outputs:
37+
version: ${{ steps.version.outputs.version }}
1938
steps:
2039
- uses: actions/checkout@v7
2140
with:
@@ -28,11 +47,24 @@ jobs:
2847
with:
2948
bundle: openapi-legacy.yaml
3049

31-
- run: bash ./generate.sh openapi-legacy.yaml "$(yq -r '.info.version' openapi-legacy.yaml)"
50+
# The SDK is a major version ahead of the specification.
51+
- id: version
52+
run: |
53+
version="${PASSED_VERSION:-$(yq -r '.info.version' openapi-legacy.yaml)}"
54+
version="$(( ${version%%.*} + 1 )).${version#*.}${VERSION_POSTPEND}"
55+
56+
echo "version=${version}" >> $GITHUB_OUTPUT
57+
58+
- if: env.VERSION_POSTPEND != ''
59+
run: yq '--inplace' ".info.version |= \"${{ steps.version.outputs.version }}\"" openapi-legacy.yaml
60+
61+
- run: bash ./generate.sh openapi-legacy.yaml "${{ steps.version.outputs.version }}"
62+
63+
- run: cp README.md src/
3264

3365
- uses: actions/upload-artifact@v7
3466
with:
35-
name: generated-csharp
67+
name: csharp-generated
3668
path: .
3769
include-hidden-files: true
3870

@@ -42,10 +74,53 @@ jobs:
4274
steps:
4375
- uses: actions/download-artifact@v8
4476
with:
45-
name: generated-csharp
77+
name: csharp-generated
4678

4779
- uses: actions/setup-dotnet@v6
4880
with:
4981
dotnet-version: '8.0.x'
5082

5183
- run: dotnet build VRChat.API.sln --configuration Release
84+
85+
publish:
86+
needs:
87+
- generate
88+
- build
89+
if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch'
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v7
93+
94+
- uses: actions/download-artifact@v8
95+
with:
96+
name: csharp-generated
97+
98+
- run: rm -f openapi-legacy.yaml
99+
100+
- uses: NuGet/setup-nuget@v4.0
101+
102+
- uses: actions/setup-dotnet@v6
103+
with:
104+
dotnet-version: '8.0.x'
105+
106+
- uses: JamesIves/github-pages-deploy-action@v4.9.0
107+
with:
108+
branch: main
109+
folder: .
110+
commit-message: Upgrade .NET SDK to spec ${{ needs.generate.outputs.version }}
111+
112+
- if: github.event_name == 'repository_dispatch'
113+
uses: pairbit/publish-nuget@v2.6.2
114+
with:
115+
PROJECT_FILE_PATH: src/VRChat.API/VRChat.API.csproj
116+
PACKAGE_NAME: VRChat.API
117+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
118+
INCLUDE_SYMBOLS: true
119+
120+
- if: github.event_name == 'repository_dispatch'
121+
uses: pairbit/publish-nuget@v2.6.2
122+
with:
123+
PROJECT_FILE_PATH: wrapper/VRChat.API.Extensions.Hosting/VRChat.API.Extensions.Hosting.csproj
124+
PACKAGE_NAME: VRChat.API.Extensions.Hosting
125+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
126+
INCLUDE_SYMBOLS: true

.github/workflows/release.yaml

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)