Skip to content

Commit 7d1daf8

Browse files
committed
wip: ci
1 parent 744b949 commit 7d1daf8

3 files changed

Lines changed: 77 additions & 74 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
on:
22
push:
3+
branches:
4+
- main
35
pull_request:
46
workflow_dispatch:
7+
inputs:
8+
no_lint:
9+
description: Skip lint job
10+
type: boolean
11+
default: false
12+
no_release:
13+
description: Skip release job
14+
type: boolean
15+
default: false
516

617
env:
718
GH_TOKEN: ${{ github.token }}
819

920
jobs:
1021
lint:
22+
if: ${{ !contains(github.event.head_commit.message, 'no_lint') && !github.event.inputs.no_lint }}
1123
runs-on: ubuntu-latest
1224
steps:
1325
- uses: actions/checkout@v4
@@ -65,6 +77,7 @@ jobs:
6577
bundle:
6678
runs-on: ubuntu-latest
6779
needs: lint
80+
if: needs.lint.result != 'failure'
6881
strategy:
6982
matrix:
7083
format: [yaml, json]
@@ -99,9 +112,9 @@ jobs:
99112
release:
100113
runs-on: ubuntu-latest
101114
needs: bundle
102-
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[dry]')
115+
if: github.ref == 'refs/heads/main' && needs.bundle.result != 'failure' && !contains(github.event.head_commit.message, 'no_release') && !github.event.inputs.no_release
103116
outputs:
104-
release: ${{ steps.data.outputs.release }}
117+
version: ${{ steps.metadata.outputs.version }}
105118

106119
steps:
107120
- uses: actions/checkout@v4
@@ -134,15 +147,22 @@ jobs:
134147
- id: metadata
135148
run: |
136149
version=$(jq -r '.info.version' dist/openapi.json)
137-
echo "version=$version" >> $GITHUB_ENV
138150
139151
version_sha=$(
140152
git rev-list -n 1 "v$version" 2>/dev/null \
141153
|| git rev-list -n 1 "release/$version" 2>/dev/null \
142154
|| echo ""
143155
)
144-
echo "version_sha=$version_sha" >> $GITHUB_ENV
145-
echo "prerelease=$(test -z "$version_sha" && echo false || echo true)" >> $GITHUB_ENV
156+
157+
if [ "$version_sha" == "" ]; then
158+
echo "prerelease=false" >> $GITHUB_ENV
159+
else
160+
echo "prerelease=true" >> $GITHUB_ENV
161+
version=$(pnpm semver $version -i)-nightly.$(git rev-list --count "$version_sha"..HEAD)
162+
fi
163+
164+
echo "version=$version" >> $GITHUB_ENV
165+
echo "::set-output name=version::$version"
146166
147167
- name: create release
148168
if: env.prerelease == 'false'
@@ -151,51 +171,15 @@ jobs:
151171
- name: create release (nightly)
152172
if: env.prerelease == 'true'
153173
run: |
154-
version=$(pnpm semver ${{ env.version }} -i)-nightly.$(git rev-list --count "${{ env.version_sha }}"..HEAD)
155-
echo "version=$version" >> $GITHUB_ENV
156-
157-
jq --arg v "$version" '.info.version = $v' dist/openapi.json > dist/.openapi.json && mv dist/.openapi.json dist/openapi.json
158-
yq eval ".info.version = \"$version\"" -i dist/openapi.yaml
174+
jq --arg v "${{ env.version }}" '.info.version = $v' dist/openapi.json > dist/.openapi.json && mv dist/.openapi.json dist/openapi.json
175+
yq eval ".info.version = \"${{ env.version }}\"" -i dist/openapi.yaml
159176
160-
gh release create v$version dist/* \
177+
gh release create v${{ env.version }} dist/* \
161178
--generate-notes \
162179
--prerelease
163180
164-
- id: data
165-
run: |
166-
release=$(gh release view v${{ env.version }} --json id,tagName,url,isPrerelease,assets | jq -c '{
167-
id,
168-
url,
169-
version: \"${{ env.version }}\"
170-
prerelease: .isPrerelease,
171-
artifacts: (
172-
.assets
173-
| map({ (.name): .url })
174-
| add
175-
)
176-
}')
177-
178-
echo "release=$release" >> $GITHUB_OUTPUT
179-
180181
release_dispatch:
181-
runs-on: ubuntu-latest
182+
uses: ./.github/workflows/release_dispatch.yaml
182183
needs: release
183-
strategy:
184-
matrix:
185-
repository:
186-
- vrchatapi-javascript
187-
- vrchatapi-csharp
188-
- vrchatapi-python
189-
- vrchatapi-java
190-
- vrchatapi-rust
191-
- vrchatapi-dart
192-
steps:
193-
- uses: actions/checkout@v4
194-
195-
- run: |
196-
jq -n --argjson payload "$release" '{ event_type: "release", client_payload: $payload }' \
197-
| gh api repos/{owner}/$repository/dispatches -X POST -i --input -
198-
env:
199-
repository: ${{ matrix.repository }}
200-
release: ${{ needs.release.outputs.release }}
201-
GH_TOKEN: ${{ secrets.RELEASE_DISPATCH_TOKEN }}
184+
with:
185+
version: ${{ needs.release.outputs.version }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
version:
5+
description: The version to dispatch the release for.
6+
required: true
7+
type: string
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: The version to dispatch the release for.
12+
required: true
13+
type: string
14+
15+
jobs:
16+
dispatch:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
repository:
21+
- vrchatapi-javascript
22+
- vrchatapi-csharp
23+
- vrchatapi-python
24+
- vrchatapi-java
25+
- vrchatapi-rust
26+
- vrchatapi-dart
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- run: |
31+
release=$(gh release view v${{ inputs.version }} --json id,tagName,url,isPrerelease,assets | jq -c '{
32+
id,
33+
url,
34+
version: \"${{ inputs.version }}\"
35+
prerelease: .isPrerelease,
36+
artifacts: (
37+
.assets
38+
| map({ (.name): .url })
39+
| add
40+
)
41+
}')
42+
43+
jq -n --argjson payload "$release" '{ event_type: "release", client_payload: $payload }' \
44+
| gh api repos/{owner}/${{ matrix.repository }}/dispatches -X POST -i --input -
45+
env:
46+
GH_TOKEN: ${{ secrets.RELEASE_DISPATCH_TOKEN }}

.github/workflows/sdk_generate.yaml

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

0 commit comments

Comments
 (0)