Skip to content

Commit 9914c5b

Browse files
committed
ci: add auto-generate
1 parent ab99a08 commit 9914c5b

4 files changed

Lines changed: 56 additions & 23 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,56 @@
1-
on: [push, pull_request]
1+
#on:
2+
# repository_dispatch:
3+
# types: [spec_release]
4+
on: push
25

3-
name: OpenAPI Java SDK CI
6+
name: Generate VRChat API SDK
47

58
jobs:
6-
gradle:
9+
generate:
710
runs-on: ubuntu-latest
11+
name: Generate VRChat API SDK
812
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up JDK 13
11-
uses: actions/setup-java@v2
13+
- uses: actions/setup-node@v1
1214
with:
13-
java-version: '13'
14-
distribution: 'adopt'
15-
- name: Validate Gradle wrapper
16-
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
17-
- name: Build with Gradle
18-
run: chmod ugo+x gradlew; ./gradlew build
19-
maven:
20-
runs-on: ubuntu-latest
21-
steps:
15+
node-version: 16
2216
- uses: actions/checkout@v2
23-
- name: Set up JDK 13
24-
uses: actions/setup-java@v2
17+
- name: 'Cache node_modules'
18+
uses: actions/cache@v2
2519
with:
26-
java-version: '13'
27-
distribution: 'adopt'
28-
- name: Build with Maven
29-
run: mvn --batch-mode verify
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: Generate SDK Client
27+
run: bash ./generate.sh
28+
- name: Check version number
29+
run: |
30+
echo "spec_version=$(grep "version =" build.gradle | cut -d "'" -f 2)" >> $GITHUB_ENV
31+
- name: Print version number
32+
run: echo ${{ env.spec_version }}
33+
- name: Deploy SDK back into main branch
34+
uses: JamesIves/github-pages-deploy-action@4.1.5
35+
with:
36+
branch: main
37+
folder: .
38+
commit-message: "Upgrade Java SDK to spec ${{ env.spec_version }}"
39+
- name: Upload to NPM
40+
uses: JS-DevTools/npm-publish@v1
41+
with:
42+
token: ${{ secrets.NPM_TOKEN }}
43+
44+
# gradle:
45+
# runs-on: ubuntu-latest
46+
# steps:
47+
# - uses: actions/checkout@v2
48+
# - name: Set up JDK 13
49+
# uses: actions/setup-java@v2
50+
# with:
51+
# java-version: '13'
52+
# distribution: 'adopt'
53+
# - name: Validate Gradle wrapper
54+
# uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
55+
# - name: Build with Gradle
56+
# run: chmod ugo+x gradlew; ./gradlew build

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ hs_err_pid*
1919
target
2020
.gradle
2121
build
22+
23+
# Dependency directory
24+
node_modules

‎.openapi-generator-ignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424

2525
README.md
2626
.travis.yml
27-
src/test/**
27+
src/test/**
28+
.gitignore

‎generate.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
22

3+
npm install @openapitools/openapi-generator-cli
4+
35
rm docs -rf
46
rm src/main/java/io/github/vrchatapi/*.java
57
rm src/main/java/io/github/vrchatapi/api -rf
68
rm src/main/java/io/github/vrchatapi/auth -rf
79
rm src/main/java/io/github/vrchatapi/model -rf
810

9-
openapi-generator-cli generate \
11+
./node_modules/\@openapitools/openapi-generator-cli/main.js generate \
1012
-g java \
1113
--additional-properties=groupId=io.github.vrchatapi,apiPackage=io.github.vrchatapi.api,invokerPackage=io.github.vrchatapi,modelPackage=io.github.vrchatapi.model,artifactId=vrchatapi,licenseName=MIT,licenseUrl=https://github.com/vrchatapi/vrchatapi-java/blob/main/LICENSE,developerEmail=me@ruby.js.org,developerName=VRChatAPI,developerOrganization=vrchatapi,developerOrganizationUrl=https://github.com/VRChatAPI,hideGenerationTimestamp=true \
1214
--git-user-id=vrchatapi \

0 commit comments

Comments
 (0)