Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/download/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Fetch a specification bundle
description: >-
Leaves the requested bundle in the working directory, taken from this run's
artifacts when running inside the specification repository, from the release
that triggered the run when there is one, and from the latest release
otherwise.

inputs:
bundle:
description: >-
Bundle to fetch.
required: false
default: openapi.json
url:
description: >-
Where to fetch the bundle from, overriding both the triggering release and
the latest one.
required: false
default: ""

runs:
using: composite
steps:
- if: github.repository == 'vrchatapi/specification'
uses: actions/download-artifact@v8
with:
name: ${{ inputs.bundle }}
path: .

- if: github.repository != 'vrchatapi/specification'
run: >-
curl -Lfo "${{ inputs.bundle }}" "${{ inputs.url
|| github.event.client_payload.artifacts[inputs.bundle]
|| format('https://github.com/vrchatapi/specification/releases/latest/download/{0}', inputs.bundle) }}"
shell: bash
28 changes: 28 additions & 0 deletions .github/actions/setup-generator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Install the OpenAPI generator
description: >-
Puts `openapi-generator` on the path at the version openapitools.json pins.
The generator is a Java program and the runner image already ships a JDK, so
nothing here needs Node.

runs:
using: composite
steps:
- uses: actions/cache@v6
with:
path: ~/.cache/openapi-generator
key: openapi-generator-${{ hashFiles('openapitools.json') }}

- run: |
set -euo pipefail

version=$(jq -re '."generator-cli".version' openapitools.json)
jar="$HOME/.cache/openapi-generator/openapi-generator-cli-$version.jar"

[ -f "$jar" ] || curl -fsSL --create-dirs -o "$jar" \
"https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$version/openapi-generator-cli-$version.jar"

mkdir -p "$HOME/.local/bin"
printf '#!/usr/bin/env bash\nexec java -jar %s "$@"\n' "$jar" > "$HOME/.local/bin/openapi-generator"
chmod +x "$HOME/.local/bin/openapi-generator"
printf '%s\n' "$HOME/.local/bin" >> "$GITHUB_PATH"
shell: bash
118 changes: 51 additions & 67 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,22 @@ on:
- main
pull_request:
workflow_dispatch:
inputs:
no_lint:
description: Skip lint job
type: boolean
default: false
no_release:
description: Skip release job
type: boolean
default: false

env:
GH_TOKEN: ${{ github.token }}

jobs:
lint:
if: ${{ !contains(github.event.head_commit.message, 'no_lint') && !github.event.inputs.no_lint }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/cache@v4
- uses: pnpm/setup@v2
with:
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: pnpm-
path: |
~/.pnpm-store
~/.cache/pnpm
**/node_modules

- uses: pnpm/action-setup@v4
with:
version: 10
run_install: false

- uses: oven-sh/setup-bun@v2

- run: pnpm install
runtime: bun@latest
cache: true

Comment thread
ariesclark marked this conversation as resolved.
- if: github.event_name == 'push'
run: |
Expand Down Expand Up @@ -74,7 +51,6 @@ jobs:
continue-on-error: true
run: pnpm run lint-ci

# Will fail if no paths are defined
- name: assert no unused paths
if: env.changes != ''
run: |
Expand All @@ -98,31 +74,16 @@ jobs:
bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/cache@v4
- uses: pnpm/setup@v2
with:
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: pnpm-
path: |
~/.pnpm-store
~/.cache/pnpm
**/node_modules

- uses: pnpm/action-setup@v4
with:
version: 10
run_install: false

- uses: oven-sh/setup-bun@v2

- run: pnpm install
runtime: bun@latest
cache: true

- run: bun --bun run bundle

- run: pnpm add @actions/artifact@5.0.2

- uses: actions/github-script@v8
- uses: actions/github-script@v9
with:
script: |
const { readdir } = require("node:fs/promises");
Expand All @@ -138,39 +99,62 @@ jobs:
return artifact.uploadArtifact(file, [pathname], dirname(pathname));
}));

build_javascript:
needs: bundle
uses: vrchatapi/vrchatapi-javascript/.github/workflows/ci.yaml@ci/modernise-actions
with:
ref: ci/modernise-actions

build_rust:
needs: bundle
uses: vrchatapi/vrchatapi-rust/.github/workflows/ci.yaml@ci/modernise-actions
with:
ref: ci/modernise-actions

build_java:
needs: bundle
uses: vrchatapi/vrchatapi-java/.github/workflows/ci.yaml@ci/modernise-actions
with:
ref: ci/modernise-actions

build_python:
needs: bundle
uses: vrchatapi/vrchatapi-python/.github/workflows/ci.yaml@ci/modernise-actions
with:
ref: ci/modernise-actions

build_csharp:
needs: bundle
uses: vrchatapi/vrchatapi-csharp/.github/workflows/ci.yaml@ci/modernise-actions
with:
ref: ci/modernise-actions

build_dart:
needs: bundle
uses: vrchatapi/vrchatapi-dart/.github/workflows/ci.yaml@ci/modernise-actions
with:
ref: ci/modernise-actions

release:
runs-on: ubuntu-latest
needs:
- lint
- bundle
if: ${{ !failure() && !cancelled() && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'no_release') && !github.event.inputs.no_release }}
if: ${{ !failure() && !cancelled() && github.ref == 'refs/heads/main' }}
outputs:
version: ${{ steps.metadata.outputs.version }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/cache@v4
with:
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: pnpm-
path: |
~/.pnpm-store
~/.cache/pnpm
**/node_modules

- uses: pnpm/action-setup@v4
- uses: pnpm/setup@v2
with:
version: 10
run_install: false

- uses: oven-sh/setup-bun@v2

- run: pnpm install
runtime: bun@latest
cache: true

- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"type": "module",
"version": "1.0.0",
"private": true,
"packageManager": "pnpm@11.20.0",
"description": "VRChat API OpenAPI Specification",
Comment thread
Copilot marked this conversation as resolved.
"author": "",
"license": "MIT",
"main": "index.js",
"engines": {
"node": ">=22"
},
"scripts": {
"lint-spectral": "bun spectral openapi/openapi.yaml",
"lint-spectral-ci": "bun spectral -i openapi/openapi.yaml",
Expand All @@ -17,6 +21,7 @@
"bundle": "redocly bundle"
},
"devDependencies": {
"@actions/artifact": "5.0.2",
"@actions/core": "^1.11.1",
"@apidevtools/json-schema-ref-parser": "^15.1.2",
"@ariesclark/eslint-config": "^3.1.1",
Expand Down
Loading
Loading