-
Notifications
You must be signed in to change notification settings - Fork 30
115 lines (103 loc) · 3.53 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
on: [push, pull_request]
name: OpenAPI Specification CI
jobs:
lint:
runs-on: ubuntu-latest
name: Lint OpenAPI specification
steps:
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: actions/checkout@v4
- name: Cache node_modules
uses: actions/cache@v4
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@v4
with:
node-version: 16
- uses: actions/checkout@v4
- name: Cache node_modules
uses: actions/cache@v4
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@v4
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@v4
- uses: actions/download-artifact@v4
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/github-pages-deploy-action@v4
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@v4
- 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
- dart
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"}'