Skip to content

Commit c292756

Browse files
committed
ci: publish from the ci workflow
1 parent d74caa3 commit c292756

2 files changed

Lines changed: 56 additions & 79 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ on:
33
branches:
44
- '**'
55
pull_request:
6+
repository_dispatch:
7+
types: [release]
8+
workflow_dispatch:
9+
inputs:
10+
url:
11+
type: string
12+
description: URL (openapi.json)
613
workflow_call:
714
inputs:
815
ref:
@@ -11,20 +18,30 @@ on:
1118
type: string
1219
default: main
1320

21+
permissions:
22+
id-token: write
23+
contents: read
24+
1425
name: CI
1526

1627
jobs:
1728
generate:
1829
runs-on: ubuntu-latest
1930
outputs:
2031
version: ${{ steps.version.outputs.version }}
32+
tag: ${{ steps.version.outputs.tag }}
2133
steps:
2234
- uses: actions/checkout@v7
2335
with:
2436
repository: vrchatapi/vrchatapi-javascript
2537
ref: ${{ inputs.ref || github.ref }}
2638

27-
- uses: vrchatapi/specification/.github/actions/download@ci/modernise-actions
39+
- id: released
40+
if: github.event_name == 'repository_dispatch' || inputs.url != ''
41+
run: curl -Lfo openapi.json "${{ github.event.client_payload.artifacts['openapi.json'] || inputs.url }}"
42+
43+
- if: steps.released.outcome == 'skipped'
44+
uses: vrchatapi/specification/.github/actions/download@ci/modernise-actions
2845

2946
- uses: pnpm/setup@v2
3047
with:
@@ -47,6 +64,7 @@ jobs:
4764
")
4865
4966
echo "version=$version" >> $GITHUB_OUTPUT
67+
echo "tag=$(node -p "require('semver').parse('$version')?.prerelease[0] || 'latest'")" >> $GITHUB_OUTPUT
5068
5169
- uses: actions/upload-artifact@v7
5270
with:
@@ -82,3 +100,40 @@ jobs:
82100
--no-template \
83101
--no-compact \
84102
--commentWithSha
103+
104+
publish:
105+
needs:
106+
- generate
107+
- build
108+
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'no_release')
109+
runs-on: ubuntu-latest
110+
steps:
111+
- uses: actions/checkout@v7
112+
with:
113+
repository: vrchatapi/vrchatapi-javascript
114+
ref: ${{ inputs.ref || github.ref }}
115+
116+
- uses: actions/download-artifact@v8
117+
with:
118+
name: generated-javascript
119+
path: src/generated
120+
121+
- uses: pnpm/setup@v2
122+
with:
123+
runtime: node@24
124+
cache: true
125+
126+
- uses: actions/setup-node@v7
127+
with:
128+
node-version: 24
129+
registry-url: https://registry.npmjs.org
130+
131+
# Trusted publishing requires npm CLI version 11.5.1 or later.
132+
# https://docs.npmjs.com/trusted-publishers
133+
- run: npm install -g npm@latest
134+
135+
- run: pnpm version ${{ needs.generate.outputs.version }} --no-git-tag-version
136+
137+
- run: pnpm build
138+
139+
- run: pnpm publish --no-git-checks --tag ${{ needs.generate.outputs.tag }}

‎.github/workflows/release.yaml‎

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

0 commit comments

Comments
 (0)