|
| 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 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + # Named explicitly: when this workflow is called, the context belongs to |
| 33 | + # the caller, so a bare checkout would fetch the caller's repository. |
| 34 | + - uses: actions/checkout@v7 |
| 35 | + with: |
| 36 | + repository: vrchatapi/vrchatapi-rust |
| 37 | + ref: ${{ inputs.ref || github.ref }} |
| 38 | + |
| 39 | + - uses: actions/setup-node@v7 |
| 40 | + with: |
| 41 | + node-version: 24 |
| 42 | + |
| 43 | + - uses: actions/setup-java@v5.7.0 |
| 44 | + with: |
| 45 | + java-version: '20' |
| 46 | + distribution: temurin |
| 47 | + |
| 48 | + - uses: moonrepo/setup-rust@v1.3.0 |
| 49 | + |
| 50 | + - run: npm install @openapitools/openapi-generator-cli |
| 51 | + |
| 52 | + - run: ./node_modules/\@openapitools/openapi-generator-cli/main.js version-manager set 7.21.0 |
| 53 | + |
| 54 | + - if: inputs.spec-artifact != '' |
| 55 | + uses: actions/download-artifact@v8 |
| 56 | + with: |
| 57 | + name: ${{ inputs.spec-artifact }} |
| 58 | + path: . |
| 59 | + |
| 60 | + - if: inputs.spec-artifact == '' |
| 61 | + run: curl -Lfo openapi.json "${{ inputs.spec-url || 'https://github.com/vrchatapi/specification/releases/latest/download/openapi.json' }}" |
| 62 | + |
| 63 | + - run: bash ./generate.sh openapi.json |
| 64 | + |
| 65 | + # The generator runs with avoidBoxedModels, so a schema that produces a |
| 66 | + # self-referential type fails to compile rather than being boxed. |
| 67 | + - run: cargo build |
| 68 | + |
| 69 | + - uses: actions/upload-artifact@v7 |
| 70 | + with: |
| 71 | + name: rust-${{ github.run_id }} |
| 72 | + path: | |
| 73 | + src |
| 74 | + docs |
| 75 | + Cargo.toml |
| 76 | + if-no-files-found: ignore |
0 commit comments