Skip to content

ci: build from a supplied spec on push, pull request, or call #1

ci: build from a supplied spec on push, pull request, or call

ci: build from a supplied spec on push, pull request, or call #1

Workflow file for this run

on:
push:
branches:
- '**'
pull_request:
workflow_call:
inputs:
spec-artifact:
description: >-
Artifact holding the bundled specification. Only reachable when the
caller shares this run, so it takes precedence over spec-url.
required: false
type: string
default: ''
spec-url:
description: Where to download the specification from.
required: false
type: string
default: https://github.com/vrchatapi/specification/releases/latest/download/openapi.json
ref:
description: Ref of this repository to build.
required: false
type: string
default: main
name: Build
jobs:
build:
name: javascript
runs-on: ubuntu-latest
steps:
# Named explicitly: when this workflow is called, the context belongs to
# the caller, so a bare checkout would fetch the caller's repository.
- uses: actions/checkout@v7
with:
repository: vrchatapi/vrchatapi-javascript
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v6
with:
version: 10
run_install: false
- uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm
- if: inputs.spec-artifact != ''
uses: actions/download-artifact@v8
with:
name: ${{ inputs.spec-artifact }}
path: .
- if: inputs.spec-artifact == ''
run: curl -Lfo openapi.json "${{ inputs.spec-url || 'https://github.com/vrchatapi/specification/releases/latest/download/openapi.json' }}"
- run: pnpm install
# `prebuild` regenerates src/generated from ./openapi.json, so this both
# generates against the specification and type-checks the result.
- run: pnpm build
- uses: actions/upload-artifact@v7
with:
name: javascript-${{ github.run_id }}
path: |
dist
src/generated
if-no-files-found: ignore