Skip to content

Remove all regex patterns and Update API Fields #886

Remove all regex patterns and Update API Fields

Remove all regex patterns and Update API Fields #886

Workflow file for this run

on: [push, pull_request]
name: OpenAPI Specification CI
jobs:
lint:
runs-on: ubuntu-latest
name: Lint OpenAPI specification
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-v16-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-v16
- name: Install Dependencies
run: npm install
- name: Run Spectral linting
run: npm run lint
bundle:
needs: lint
runs-on: ubuntu-latest
name: Bundle and Filter OpenAPI specification
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-v16-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-v16
- name: Bundle OpenAPI Specification 📦
run: npm run bundle
- name: Upload Bundled Specification as Artifact 📤
uses: actions/upload-artifact@v3
with:
name: openapi-bundled
path: dist
pages:
# Only if main branch
if: github.ref == 'refs/heads/main'
needs: bundle
runs-on: ubuntu-latest
name: Upload OpenAPI specification to GitHub Pages
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: openapi-bundled
path: dist
- name: Disable Jekyll for Github Pages
run: sudo touch dist/.nojekyll; sudo touch dist/index.html
- name: Prevent Cloudflare Pages (used for dev preview) from breaking
run: mkdir dist/dist; cp dist/openapi.yaml dist/dist/openapi.yaml; cp .github/files/empty.json dist/package.json
- name: Deploy Bundle to Github Pages 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist
version_check:
# Only if tag "release/*" is pushed
if: ${{ startsWith(github.ref, 'refs/tags/release/') }}
needs: bundle
name: Check if OpenAPI specification version is matching tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check if OpenAPI specification version is matching tag
# Tag will be e.g., "release/1.0.0", check if this matches the version in openapi/openapi.yaml
run: |
if [[ $(cat openapi/openapi.yaml | grep -oP '(?<=version: ).*') != $(echo $GITHUB_REF | grep -oP '(?<=release/).*') ]]; then
echo "OpenAPI specification version does not match tag!"
exit 1
fi
# https://blog.marcnuri.com/triggering-github-actions-across-different-repositories
# Make sure this is same as in sdk_generate.yaml
sdk_generate:
runs-on: ubuntu-latest
needs: version_check
name: Trigger Remote SDK builds
strategy:
matrix:
project:
- javascript
- csharp
- python
- java
- rust
steps:
- name: Triggering build SDK - ${{ matrix.node }}
run: |
curl -X POST https://api.github.com/repos/vrchatapi/vrchatapi-${{ matrix.project }}/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "spec_release"}'