Skip to content

Commit 7cf3427

Browse files
committed
ci: build from a supplied spec on push, pull request, or call
1 parent 0d747f2 commit 7cf3427

2 files changed

Lines changed: 71 additions & 48 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
on:
2+
push:
3+
branches:
4+
- '**'
5+
pull_request:
6+
workflow_call:
7+
inputs:
8+
spec-artifact:
9+
description: >-
10+
Artifact holding the bundled specification. Only reachable when the
11+
caller shares this run, so it takes precedence over spec-url.
12+
required: false
13+
type: string
14+
default: ''
15+
spec-url:
16+
description: Where to download the specification from.
17+
required: false
18+
type: string
19+
default: https://github.com/vrchatapi/specification/releases/latest/download/openapi.json
20+
ref:
21+
description: Ref of this repository to build.
22+
required: false
23+
type: string
24+
default: main
25+
26+
name: Build
27+
28+
jobs:
29+
build:
30+
name: javascript
31+
runs-on: ubuntu-latest
32+
steps:
33+
# Named explicitly: when this workflow is called, the context belongs to
34+
# the caller, so a bare checkout would fetch the caller's repository.
35+
- uses: actions/checkout@v7
36+
with:
37+
repository: vrchatapi/vrchatapi-javascript
38+
ref: ${{ inputs.ref || github.ref }}
39+
40+
- uses: pnpm/action-setup@v6
41+
with:
42+
version: 10
43+
run_install: false
44+
45+
- uses: actions/setup-node@v7
46+
with:
47+
node-version: 24
48+
cache: pnpm
49+
50+
- if: inputs.spec-artifact != ''
51+
uses: actions/download-artifact@v8
52+
with:
53+
name: ${{ inputs.spec-artifact }}
54+
path: .
55+
56+
- if: inputs.spec-artifact == ''
57+
run: curl -Lfo openapi.json "${{ inputs.spec-url || 'https://github.com/vrchatapi/specification/releases/latest/download/openapi.json' }}"
58+
59+
- run: pnpm install
60+
61+
# `prebuild` regenerates src/generated from ./openapi.json, so this both
62+
# generates against the specification and type-checks the result.
63+
- run: pnpm build
64+
65+
- uses: actions/upload-artifact@v7
66+
with:
67+
name: javascript-${{ github.run_id }}
68+
path: |
69+
dist
70+
src/generated
71+
if-no-files-found: ignore

‎.github/workflows/spec-check.yaml‎

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)