Skip to content

Commit 9b8e40c

Browse files
committed
ci: split the checks into their own jobs and separate release
1 parent 8c5cc59 commit 9b8e40c

3 files changed

Lines changed: 100 additions & 100 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎.github/workflows/ci.yaml‎

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,44 @@
11
on:
2-
repository_dispatch:
3-
types: [release]
4-
workflow_dispatch:
2+
push:
3+
branches:
4+
- '**'
5+
pull_request:
6+
workflow_call:
57
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.
1210
required: false
1311
type: string
14-
default: ''
12+
default: main
1513

16-
name: Generate VRChat API SDK
14+
name: CI
1715

1816
jobs:
19-
generate:
17+
build:
2018
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 || '' }}
2819
steps:
2920
- uses: actions/checkout@v7
21+
with:
22+
repository: vrchatapi/vrchatapi-python
23+
ref: ${{ inputs.ref || github.ref }}
3024

3125
- uses: vrchatapi/specification/.github/actions/setup-generator@ci/modernise-actions
3226

33-
- name: Set up Python 3.14
34-
uses: actions/setup-python@v7
27+
- uses: vrchatapi/specification/.github/actions/download@ci/modernise-actions
3528
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
4830

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
5535

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)"
5837

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
6539

66-
- name: Install pypa/build
67-
run: python -m pip install build --user
40+
- run: python -m build
6841

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
7143

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__)"

‎.github/workflows/release.yaml‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
on:
2+
repository_dispatch:
3+
types: [release]
4+
workflow_dispatch:
5+
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'
12+
required: false
13+
type: string
14+
default: ''
15+
16+
name: Generate VRChat API SDK
17+
18+
jobs:
19+
generate:
20+
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+
steps:
29+
- uses: actions/checkout@v7
30+
31+
- uses: vrchatapi/specification/.github/actions/setup-generator@ci/modernise-actions
32+
33+
- name: Set up Python 3.14
34+
uses: actions/setup-python@v7
35+
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
48+
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 }}"
55+
56+
- name: Delete openapi.yaml file
57+
run: unlink ${ARTIFACT_NAME}
58+
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 }}"
65+
66+
- name: Install pypa/build
67+
run: python -m pip install build --user
68+
69+
- name: Build a binary wheel and a source tarball
70+
run: python -m build --sdist --wheel --outdir dist/ .
71+
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 }}

0 commit comments

Comments
 (0)