-
Notifications
You must be signed in to change notification settings - Fork 17
112 lines (96 loc) · 4.5 KB
/
ci.yaml
File metadata and controls
112 lines (96 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
on:
repository_dispatch:
types: [release]
workflow_dispatch:
inputs:
json:
description: 'Passed json from repository_dispatch'
required: true
type: string
version_postfix:
description: 'Additional string to concatenate onto the existing version before release'
required: false
type: string
default: ''
name: Generate VRChat API SDK
jobs:
generate:
runs-on: ubuntu-latest
name: Generate VRChat API SDK
env:
ARTIFACT_NAME: "openapi.yaml"
INPUT: ${{ github.event_name == 'repository_dispatch' && toJSON(github.event.client_payload) || inputs.json }}
SPEC_URL: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['artifacts']['openapi-legacy.yaml'] }}
PASSED_VERSION: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['version'] }}
VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/checkout@v4
- name: 'Cache node_modules'
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/generate.sh') }}
restore-keys: |
${{ runner.os }}-node-v22
- name: Install OpenAPI Generator CLI
run: npm install @openapitools/openapi-generator-cli
- name: Set OpenAPI Generator version
run: ./node_modules/\@openapitools/openapi-generator-cli/main.js version-manager set 7.17.0
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.1.1
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
- name: Download Specification
run: wget "${SPEC_URL}" '--output-document' "${ARTIFACT_NAME}"
- name: Check version number
run: |
vrchat_sdk_version=$(( ${PASSED_VERSION%%.*} + 1)).${PASSED_VERSION#*.}${VERSION_POSTPEND}
echo "Version is: ${vrchat_sdk_version}"
echo "vrchat_sdk_version=$vrchat_sdk_version" >> $GITHUB_ENV
- name: Apply Version Postpend
if: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix != '' }}
run: yq '--inplace' ".info.version |= \"${vrchat_sdk_version}\"" "${ARTIFACT_NAME}"
- name: Generate SDK Client
run: bash ./generate.sh "${ARTIFACT_NAME}" "${vrchat_sdk_version}"
- name: Copy README.md into src/
run: cp README.md src/
- name: Delete openapi.json file
run: unlink ${ARTIFACT_NAME}
- name: Deploy SDK back into main branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: main
folder: .
commit-message: "Upgrade .NET SDK to spec ${{ env.vrchat_sdk_version }}"
- name: Publish to VRChat.API to NuGet
if: github.event_name == 'repository_dispatch'
uses: pairbit/publish-nuget@v2.5.8
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: src/VRChat.API/VRChat.API.csproj
# NuGet package id, used for version detection & defaults to project name
PACKAGE_NAME: VRChat.API
# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_KEY}}
# NuGet server uri hosting the packages, defaults to https://api.nuget.org
# NUGET_SOURCE: https://api.nuget.org
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
INCLUDE_SYMBOLS: true
- name: Publish to VRChat.API.Extensions.Hosting to NuGet
if: github.event_name == 'repository_dispatch'
uses: pairbit/publish-nuget@v2.5.8
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: wrapper/VRChat.API.Extensions.Hosting/VRChat.API.Extensions.Hosting.csproj
# NuGet package id, used for version detection & defaults to project name
PACKAGE_NAME: VRChat.API.Extensions.Hosting
# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_KEY}}
# NuGet server uri hosting the packages, defaults to https://api.nuget.org
# NUGET_SOURCE: https://api.nuget.org
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
INCLUDE_SYMBOLS: true