From 9ba4e6c33f48dacb59e19800e896744f267cef3f Mon Sep 17 00:00:00 2001 From: Foorack Date: Sat, 7 Nov 2026 20:29:29 +0100 Subject: [PATCH 1/8] ci: rename ci.yaml to release.yaml --- .github/workflows/{ci.yaml => release.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci.yaml => release.yaml} (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/release.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/release.yaml From db69c5bb9fc6d52a6f24b58a34617d8195b11291 Mon Sep 17 00:00:00 2001 From: Foorack Date: Sat, 7 Nov 2026 20:29:52 +0100 Subject: [PATCH 2/8] ci: create a build-only ci.yaml ci.yaml is called as a reusable workflow by vrchatapi/specification, and a nested job may not request more permissions than the calling job grants. The publish job needs contents: write and id-token: write for NuGet Trusted Publishing, which forced every caller to hand both over. It now only generates and builds, read-only, and exposes the generated version as a workflow_call output. release.yaml calls it for the build and keeps the elevated permissions on its own publish job. --- .github/workflows/ci.yaml | 92 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 85 ++++--------------------------- 2 files changed, 103 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..06eeb165 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,92 @@ +on: + push: + branches: + - "**" + pull_request: + workflow_call: + inputs: + ref: + description: Ref of this repository to build. + required: false + type: string + default: main + tag: + description: Release to build, such as v1.22.1 or nightly. Defaults to the latest release. + required: false + type: string + default: "" + version_postfix: + description: Additional string to concatenate onto the existing version before release + required: false + type: string + default: "" + outputs: + version: + description: The version the SDK was generated as. + value: ${{ jobs.generate.outputs.version }} + +name: CI + +# Reusable workflow: callers only ever need to read, so never hand out more. +permissions: + contents: read + +env: + VERSION_POSTPEND: ${{ inputs.version_postfix }} + +jobs: + generate: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v7 + with: + repository: vrchatapi/vrchatapi-csharp + ref: ${{ inputs.ref || github.ref }} + + - uses: vrchatapi/specification/.github/actions/setup-generator@main + + - uses: vrchatapi/specification/.github/actions/download@main + with: + bundle: openapi-3.1.json + tag: ${{ inputs.tag }} + + # The SDK is a major and a minor version ahead of the specification. + - id: version + run: | + version="$(yq -r '.info.version' openapi-3.1.json)" + major="${version%%.*}" + rest="${version#*.}" + version="$(( major + 1 )).$(( ${rest%%.*} + 1 )).${rest#*.}${VERSION_POSTPEND}" + + echo "version=${version}" >> $GITHUB_OUTPUT + + - if: env.VERSION_POSTPEND != '' + run: yq '--inplace' ".info.version |= \"${{ steps.version.outputs.version }}\"" openapi-3.1.json + + - run: bash ./generate.sh openapi-3.1.json "${{ steps.version.outputs.version }}" + + - run: cp README.md src/ + + - uses: actions/upload-artifact@v7 + with: + name: csharp-generated + path: | + . + !.git/** + include-hidden-files: true + + build: + needs: generate + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v8 + with: + name: csharp-generated + + - uses: actions/setup-dotnet@v6 + with: + dotnet-version: "8.0.x" + + - run: dotnet build VRChat.API.sln --configuration Release diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 608fe2a1..f5954253 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,8 +1,4 @@ on: - push: - branches: - - "**" - pull_request: repository_dispatch: types: [release] workflow_dispatch: @@ -17,82 +13,23 @@ on: required: false type: string default: "" - workflow_call: - inputs: - ref: - description: Ref of this repository to build. - required: false - type: string - default: main -name: CI +name: Release -env: - VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }} +# Publishing needs write access and an OIDC token, so it lives in its own file. +# ci.yaml stays read-only and can be called from other repositories as-is. +permissions: + contents: read jobs: - generate: - runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - uses: actions/checkout@v7 - with: - repository: vrchatapi/vrchatapi-csharp - ref: ${{ inputs.ref || github.ref }} - - - uses: vrchatapi/specification/.github/actions/setup-generator@main - - - uses: vrchatapi/specification/.github/actions/download@main - with: - bundle: openapi-3.1.json - tag: ${{ inputs.tag }} - - # The SDK is a major and a minor version ahead of the specification. - - id: version - run: | - version="$(yq -r '.info.version' openapi-3.1.json)" - major="${version%%.*}" - rest="${version#*.}" - version="$(( major + 1 )).$(( ${rest%%.*} + 1 )).${rest#*.}${VERSION_POSTPEND}" - - echo "version=${version}" >> $GITHUB_OUTPUT - - - if: env.VERSION_POSTPEND != '' - run: yq '--inplace' ".info.version |= \"${{ steps.version.outputs.version }}\"" openapi-3.1.json - - - run: bash ./generate.sh openapi-3.1.json "${{ steps.version.outputs.version }}" - - - run: cp README.md src/ - - - uses: actions/upload-artifact@v7 - with: - name: csharp-generated - path: | - . - !.git/** - include-hidden-files: true - build: - needs: generate - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v8 - with: - name: csharp-generated - - - uses: actions/setup-dotnet@v6 - with: - dotnet-version: "8.0.x" - - - run: dotnet build VRChat.API.sln --configuration Release + uses: ./.github/workflows/ci.yaml + with: + tag: ${{ inputs.tag }} + version_postfix: ${{ inputs.version_postfix }} publish: - needs: - - generate - - build - if: github.repository == 'vrchatapi/vrchatapi-csharp' - && (github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch') + needs: build runs-on: ubuntu-latest permissions: contents: write # Push the generated SDK back to main @@ -120,7 +57,7 @@ jobs: with: branch: main folder: . - commit-message: Upgrade .NET SDK to spec ${{ needs.generate.outputs.version }} + commit-message: Upgrade .NET SDK to spec ${{ needs.build.outputs.version }} - if: github.event_name == 'repository_dispatch' name: Pack packages From e3f6390f09865d3e38efed092a09ee9c543f4ef8 Mon Sep 17 00:00:00 2001 From: Foorack Date: Sat, 7 Nov 2026 22:36:59 +0100 Subject: [PATCH 3/8] ci: name the version suffix variable after its input VERSION_POSTPEND was called version_postfix everywhere else. --- .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 06eeb165..2b0904d1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,7 +32,7 @@ permissions: contents: read env: - VERSION_POSTPEND: ${{ inputs.version_postfix }} + VERSION_POSTFIX: ${{ inputs.version_postfix }} jobs: generate: @@ -58,11 +58,11 @@ jobs: version="$(yq -r '.info.version' openapi-3.1.json)" major="${version%%.*}" rest="${version#*.}" - version="$(( major + 1 )).$(( ${rest%%.*} + 1 )).${rest#*.}${VERSION_POSTPEND}" + version="$(( major + 1 )).$(( ${rest%%.*} + 1 )).${rest#*.}${VERSION_POSTFIX}" echo "version=${version}" >> $GITHUB_OUTPUT - - if: env.VERSION_POSTPEND != '' + - if: env.VERSION_POSTFIX != '' run: yq '--inplace' ".info.version |= \"${{ steps.version.outputs.version }}\"" openapi-3.1.json - run: bash ./generate.sh openapi-3.1.json "${{ steps.version.outputs.version }}" From bf0c818888178d30e3d23f35d2e6356416bcf425 Mon Sep 17 00:00:00 2001 From: Foorack Date: Sat, 7 Nov 2026 22:38:00 +0100 Subject: [PATCH 4/8] ci: drop the redundant checkout repository and queue release runs The publish job can only exist in this repository now, so the explicit repository input does nothing. Concurrency stops two dispatches racing to commit the generated SDK to main. --- .github/workflows/release.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f5954253..e551b1ac 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -21,6 +21,9 @@ name: Release permissions: contents: read +concurrency: + group: release + jobs: build: uses: ./.github/workflows/ci.yaml @@ -36,8 +39,6 @@ jobs: id-token: write # OIDC token exchanged for a short-lived NuGet API key steps: - uses: actions/checkout@v7 - with: - repository: vrchatapi/vrchatapi-csharp # The artifact is overlaid onto the checkout rather than replacing it, so anything the # generator stops emitting would otherwise survive in src/ forever. From 80b71aeb39b4f04b99641296cd33cad542e8487b Mon Sep 17 00:00:00 2001 From: Aries Clark Date: Sat, 7 Nov 2026 17:32:34 -0500 Subject: [PATCH 5/8] ci: queue every pending release run instead of only the latest --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e551b1ac..97b2bd40 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,6 +23,7 @@ permissions: concurrency: group: release + queue: max jobs: build: From 1ce54bbb28799bf3573bc982576ee3478311f072 Mon Sep 17 00:00:00 2001 From: Aries Clark Date: Sat, 7 Nov 2026 17:32:42 -0500 Subject: [PATCH 6/8] ci: generate releases from the commit that triggered them --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 97b2bd40..5be2aa83 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -29,6 +29,7 @@ jobs: build: uses: ./.github/workflows/ci.yaml with: + ref: ${{ github.sha }} tag: ${{ inputs.tag }} version_postfix: ${{ inputs.version_postfix }} From 65676da142c2d055d255f267267596773af5c1a6 Mon Sep 17 00:00:00 2001 From: Aries Clark Date: Sat, 7 Nov 2026 17:32:46 -0500 Subject: [PATCH 7/8] ci: publish only from vrchatapi/vrchatapi-csharp, never a fork --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5be2aa83..07898a79 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,6 +35,7 @@ jobs: publish: needs: build + if: github.repository == 'vrchatapi/vrchatapi-csharp' runs-on: ubuntu-latest permissions: contents: write # Push the generated SDK back to main From 6a878a9286e6e67755e32bd1e4b6058b677ce0fa Mon Sep 17 00:00:00 2001 From: Aries Clark Date: Sat, 7 Nov 2026 17:32:51 -0500 Subject: [PATCH 8/8] ci: drop comments restating the permissions blocks --- .github/workflows/ci.yaml | 1 - .github/workflows/release.yaml | 2 -- 2 files changed, 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2b0904d1..2ef32daf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,6 @@ on: name: CI -# Reusable workflow: callers only ever need to read, so never hand out more. permissions: contents: read diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 07898a79..687dadbc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,8 +16,6 @@ on: name: Release -# Publishing needs write access and an OIDC token, so it lives in its own file. -# ci.yaml stays read-only and can be called from other repositories as-is. permissions: contents: read