Skip to content

Commit b34aa7a

Browse files
committed
ci: add auto-build
1 parent d89599b commit b34aa7a

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#on:
2+
# repository_dispatch:
3+
# types: [spec_release]
4+
on: push
5+
6+
name: Generate VRChat API SDK
7+
8+
jobs:
9+
generate:
10+
runs-on: ubuntu-latest
11+
name: Generate VRChat API SDK
12+
steps:
13+
- uses: actions/setup-node@v1
14+
with:
15+
node-version: 16
16+
- uses: actions/checkout@v2
17+
- name: 'Cache node_modules'
18+
uses: actions/cache@v2
19+
with:
20+
path: node_modules
21+
key: ${{ runner.os }}-node-v16-${{ hashFiles('**/generate.sh') }}
22+
restore-keys: |
23+
${{ runner.os }}-node-v16
24+
- name: Install OpenAPI Generator CLI
25+
run: npm install @openapitools/openapi-generator-cli
26+
- name: Set up Python 3.9
27+
uses: actions/setup-python@v1
28+
with:
29+
python-version: 3.9
30+
- name: Generate SDK Client
31+
run: bash ./generate.sh
32+
- name: Check version number
33+
run: |
34+
echo "spec_version=$(grep "version" ./package.json | cut -d "\"" -f 4)" >> $GITHUB_ENV
35+
- name: Print version number
36+
run: echo ${{ env.spec_version }}
37+
- name: Deploy SDK back into main branch
38+
uses: JamesIves/github-pages-deploy-action@4.1.5
39+
with:
40+
branch: main
41+
folder: .
42+
commit-message: "Upgrade Python SDK to spec ${{ env.spec_version }}"
43+
- name: Install pypa/build
44+
run: python -m pip install build --user
45+
- name: Build a binary wheel and a source tarball
46+
run: python -m build --sdist --wheel --outdir dist/ .
47+
- name: Publish SDK 📦 to PyPI
48+
uses: pypa/gh-action-pypi-publish@master
49+
with:
50+
password: ${{ secrets.PYPI_API_TOKEN }}

‎generate.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
22

3+
npm install @openapitools/openapi-generator-cli
4+
35
rm vrchatapi docs -rf
4-
openapi-generator-cli generate \
6+
7+
./node_modules/\@openapitools/openapi-generator-cli/main.js generate \
58
-g python \
69
--additional-properties=packageName=vrchatapi,projectName=vrchatapi \
710
--git-user-id=vrchatapi \

0 commit comments

Comments
 (0)