|
1 | 1 | on: |
2 | | - repository_dispatch: |
3 | | - types: [release] |
4 | | - workflow_dispatch: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - '**' |
| 5 | + pull_request: |
| 6 | + workflow_call: |
5 | 7 | inputs: |
6 | | - json: |
7 | | - description: 'Passed json from repository_dispatch' |
8 | | - required: true |
9 | | - type: string |
10 | | - version_postfix: |
11 | | - description: 'Additional string to concatenate onto the existing version before release' |
| 8 | + ref: |
| 9 | + description: Ref of this repository to build. |
12 | 10 | required: false |
13 | 11 | type: string |
14 | | - default: '' |
| 12 | + default: main |
15 | 13 |
|
16 | | -name: Generate VRChat API SDK |
| 14 | +name: CI |
17 | 15 |
|
18 | 16 | jobs: |
19 | | - generate: |
| 17 | + build: |
20 | 18 | runs-on: ubuntu-latest |
21 | | - name: Generate VRChat API SDK |
22 | | - env: |
23 | | - ARTIFACT_NAME: "openapi.yaml" |
24 | | - INPUT: ${{ github.event_name == 'repository_dispatch' && toJSON(github.event.client_payload) || inputs.json }} |
25 | | - SPEC_URL: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['artifacts']['openapi-legacy.yaml'] }} |
26 | | - PASSED_VERSION: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['version'] }} |
27 | | - VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }} |
28 | 19 | steps: |
29 | 20 | - uses: actions/checkout@v7 |
| 21 | + with: |
| 22 | + repository: vrchatapi/vrchatapi-python |
| 23 | + ref: ${{ inputs.ref || github.ref }} |
30 | 24 |
|
31 | 25 | - uses: vrchatapi/specification/.github/actions/setup-generator@ci/modernise-actions |
32 | 26 |
|
33 | | - - name: Set up Python 3.14 |
34 | | - uses: actions/setup-python@v7 |
| 27 | + - uses: vrchatapi/specification/.github/actions/download@ci/modernise-actions |
35 | 28 | with: |
36 | | - python-version: 3.14 |
37 | | - |
38 | | - - name: Download Specification |
39 | | - run: wget "${SPEC_URL}" '--output-document' "${ARTIFACT_NAME}" |
40 | | - |
41 | | - - name: Set version |
42 | | - id: version |
43 | | - run: | |
44 | | - # Replace using bash |
45 | | - VERSION="${PASSED_VERSION}${VERSION_POSTPEND}" |
46 | | - CLEAN_VERSION="${VERSION/-nightly./.dev}" |
47 | | - echo "version=${CLEAN_VERSION}" >> $GITHUB_OUTPUT |
| 29 | + bundle: openapi-legacy.yaml |
48 | 30 |
|
49 | | - - name: Apply Version Postpend |
50 | | - if: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix != '' }} |
51 | | - run: yq '--inplace' ".info.version |= \"${{ steps.version.outputs.version }}\"" "${ARTIFACT_NAME}" |
52 | | - |
53 | | - - name: Generate SDK Client |
54 | | - run: bash ./generate.sh "${ARTIFACT_NAME}" "${{ steps.version.outputs.version }}" |
| 31 | + - uses: actions/setup-python@v7 |
| 32 | + with: |
| 33 | + python-version: '3.14' |
| 34 | + cache: pip |
55 | 35 |
|
56 | | - - name: Delete openapi.yaml file |
57 | | - run: unlink ${ARTIFACT_NAME} |
| 36 | + - run: bash ./generate.sh openapi-legacy.yaml "$(yq -r '.info.version' openapi-legacy.yaml)" |
58 | 37 |
|
59 | | - - name: Deploy SDK back into main branch |
60 | | - uses: JamesIves/github-pages-deploy-action@v4.9.0 |
61 | | - with: |
62 | | - branch: main |
63 | | - folder: . |
64 | | - commit-message: "Upgrade Python SDK to spec ${{ steps.version.outputs.version }}" |
| 38 | + - run: python -m pip install build |
65 | 39 |
|
66 | | - - name: Install pypa/build |
67 | | - run: python -m pip install build --user |
| 40 | + - run: python -m build |
68 | 41 |
|
69 | | - - name: Build a binary wheel and a source tarball |
70 | | - run: python -m build --sdist --wheel --outdir dist/ . |
| 42 | + - run: python -m pip install dist/*.whl |
71 | 43 |
|
72 | | - - name: Publish SDK 📦 to PyPI |
73 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
74 | | - with: |
75 | | - skip_existing: true |
76 | | - password: ${{ secrets.PYPI_API_TOKEN }} |
| 44 | + - run: python -c "import vrchatapi; print(vrchatapi.__name__)" |
0 commit comments