From a4c43bd6319aafc5e97fa771a9d62b261831c181 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sat, 27 Dec 2025 11:20:22 +0100 Subject: [PATCH 1/5] Update CI to match dotnet's version --- .github/workflows/ci.yaml | 46 +++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f2b3bb3a..05ce073e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,8 +1,17 @@ on: repository_dispatch: - types: [spec_release] + types: [release] workflow_dispatch: -#on: push + 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 @@ -10,11 +19,19 @@ jobs: generate: runs-on: ubuntu-latest name: Generate VRChat API SDK + env: + ARTIFACT_NAME: "openapi.yaml" + INPUT: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json }} + SPEC_URL: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['artifacts']['openapi-legacy.yaml'] }} + PASSED_VERSION: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['version'] }} + VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }} steps: - uses: actions/setup-node@v1 with: node-version: 16 + - uses: actions/checkout@v2 + - name: 'Cache node_modules' uses: actions/cache@v4 with: @@ -22,31 +39,46 @@ jobs: key: ${{ runner.os }}-node-v16-${{ hashFiles('**/generate.sh') }} restore-keys: | ${{ runner.os }}-node-v16 + - 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 6.2.1 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: python-version: 3.9 - - name: Generate SDK Client - run: bash ./generate.sh + + - name: Download Specification + run: wget "${SPEC_URL}" '--output-document' "${ARTIFACT_NAME}" + - name: Check version number run: | - echo "spec_version=$(grep "VERSION =" setup.py | cut -d "\"" -f 2)" >> $GITHUB_ENV - - name: Print version number - run: echo ${{ env.spec_version }} + 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: Generate SDK Client + run: bash ./generate.sh "${ARTIFACT_NAME}" "${vrchat_sdk_version}" + + - name: Delete openapi.yaml 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 Python SDK to spec ${{ env.spec_version }}" + - name: Install pypa/build run: python -m pip install build --user + - name: Build a binary wheel and a source tarball run: python -m build --sdist --wheel --outdir dist/ . + - name: Publish SDK 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: From 1d1c9e57cd2cca192b06501f625a8018fa9699ed Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sat, 27 Dec 2025 11:32:38 +0100 Subject: [PATCH 2/5] Update generate too --- generate.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/generate.sh b/generate.sh index c849b6a4..b162d15c 100755 --- a/generate.sh +++ b/generate.sh @@ -1,7 +1,10 @@ -#!/bin/bash - -npm install @openapitools/openapi-generator-cli +#!/usr/bin/env bash +if [ ${#} -le 1 ] +then + echo "Usage: generate.sh " >&2 + exit 1 +fi rm vrchatapi docs -rf ./node_modules/\@openapitools/openapi-generator-cli/main.js generate \ @@ -10,13 +13,12 @@ rm vrchatapi docs -rf --git-user-id=vrchatapi \ --git-repo-id=vrchatapi-python \ -o . \ --i https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml \ +-i "${1}" \ --http-user-agent="vrchatapi-py" # Fix description, keywords, etc... # Echo to trim whitespace -VERSION=`echo $(cat setup.py | grep "The version of the OpenAPI document" | cut -d ":" -f 2)` -sed -i "s/VERSION = \"1.0.0\"/VERSION = \"$VERSION\"/" ./setup.py +sed -i "s/VERSION = \"1.0.0\"/VERSION = \"${2}\"/" ./setup.py sed -i 's/description="VRChat API Documentation"/description="VRChat API Library for Python"/' ./setup.py sed -i 's/keywords=\["OpenAPI", "OpenAPI-Generator", "VRChat API Documentation"\]/keywords=["vrchat", "vrchatapi", "vrc"]/' ./setup.py From b0ec974ee73c44b448065a7e7c8780c5a79c171d Mon Sep 17 00:00:00 2001 From: JelleJurre <76777936+jellejurre@users.noreply.github.com> Date: Sun, 28 Dec 2025 01:42:33 +0100 Subject: [PATCH 3/5] Update .github/workflows/ci.yaml Co-authored-by: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com> --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 05ce073e..4e2c7d5b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,9 +21,9 @@ jobs: name: Generate VRChat API SDK env: ARTIFACT_NAME: "openapi.yaml" - INPUT: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json }} - SPEC_URL: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['artifacts']['openapi-legacy.yaml'] }} - PASSED_VERSION: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['version'] }} + 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@v1 From 127f1740236dda421bbb172dd82671ac331de701 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 28 Dec 2025 01:46:10 +0100 Subject: [PATCH 4/5] Remove error from copy --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4e2c7d5b..0ce13e22 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,7 +56,7 @@ jobs: - name: Check version number run: | - vrchat_sdk_version=$(( ${PASSED_VERSION%%.*} + 1)).${PASSED_VERSION#*.}${VERSION_POSTPEND} + vrchat_sdk_version=$(( ${PASSED_VERSION%%.*})).${PASSED_VERSION#*.}${VERSION_POSTPEND} echo "Version is: ${vrchat_sdk_version}" echo "vrchat_sdk_version=$vrchat_sdk_version" >> $GITHUB_ENV From 4cbce3d0b0d8a6a1463d6d7f8ef078d5a64707da Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 28 Dec 2025 01:47:53 +0100 Subject: [PATCH 5/5] Fix wrong commit message --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0ce13e22..e0dcfb22 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,7 +71,7 @@ jobs: with: branch: main folder: . - commit-message: "Upgrade Python SDK to spec ${{ env.spec_version }}" + commit-message: "Upgrade Python SDK to spec ${vrchat_sdk_version}" - name: Install pypa/build run: python -m pip install build --user