forked from biomejs/biome
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (141 loc) · 5.62 KB
/
release_js_api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Release JavaScript API
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 2-6'
push:
# branches:
# - main
# paths:
# - npm/js-api/package.json
jobs:
check:
name: Check version
runs-on: ubuntu-latest
outputs:
version: ${{ env.version }}
prerelease: ${{ env.prerelease }}
nightly: ${{ env.nightly }}
version_changed: ${{ steps.version.outputs.changed }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Check nightly status
id: nightly
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: echo "nightly=true" >> $GITHUB_ENV
- name: Check version changes
uses: EndBug/version-check@d4be4219408b50d1bbbfd350a47cbcb126878692 # v2.1.4
if: env.nightly != 'true'
id: version
with:
diff-search: true
file-name: packages/@biomejs/js-api/package.json
- name: Set version name
run: echo "version=${{ steps.version.outputs.version }}" >> $GITHUB_ENV
- name: Check prerelease status
id: prerelease
if: env.nightly == 'true'
run: echo "prerelease=true" >> $GITHUB_ENV
- name: Check version status
if: steps.version.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})"'
build:
name: Package JavaScript APIs
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.version_changed == 'true' || needs.check.outputs.nightly == 'true'
outputs:
version: ${{ env.version }}
prerelease: ${{ env.prerelease }}
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache pnpm modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: Set release infos
if: needs.check.outputs.prerelease == 'true'
run: |
echo "prerelease=true" >> $GITHUB_ENV
node packages/@biomejs/js-api/scripts/update-nightly-version.mjs >> $GITHUB_ENV
- name: Set release infos
if: needs.check.outputs.prerelease != 'true'
run: |
echo "prerelease=false" >> $GITHUB_ENV
echo "version=${{ needs.check.outputs.version }}" >> $GITHUB_ENV
- name: Compile backends
run: |
pnpm --filter @biomejs/js-api run build:wasm-bundler
pnpm --filter @biomejs/js-api run build:wasm-node
pnpm --filter @biomejs/js-api run build:wasm-web
pnpm --filter @biomejs/backend-jsonrpc i
pnpm --filter @biomejs/backend-jsonrpc run build
- name: Build package
run: |
pnpm --filter @biomejs/js-api i
pnpm --filter @biomejs/js-api run build
- name: Upload JS API artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: js-api
path: |
./packages/@biomejs/js-api/dist
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
needs: build
environment: npm-publish
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Download package artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: js-api
path: packages/@biomejs/js-api/dist
- name: Install Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Set release infos
if: needs.build.outputs.prerelease == 'true'
run: node packages/@biomejs/js-api/scripts/update-nightly-version.mjs
- name: Publish npm package as latest
run: npm publish packages/@biomejs/js-api --tag latest --access public --provenance
if: needs.build.outputs.prerelease != 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish npm package as nightly
run: npm publish packages/@biomejs/js-api --tag nightly --access public --provenance
if: needs.build.outputs.prerelease == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract changelog
run: |
bash scripts/print-changelog.sh ${{ needs.build.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES
- name: Create GitHub release and tag
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: JavaScript APIs v${{ needs.build.outputs.version }}
tag_name: js-api/v${{ needs.build.outputs.version }}
draft: false
prerelease: ${{ needs.build.outputs.prerelease == 'true' }}
body_path: ${{ github.workspace }}/RELEASE_NOTES
generate_release_notes: true