-
Notifications
You must be signed in to change notification settings - Fork 2
330 lines (322 loc) · 12 KB
/
release-hosts.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
name: Release host package
on:
workflow_dispatch:
inputs:
release-level:
description: "Release level"
required: true
type: choice
default: prerelease
options:
- prerelease
- patch
- minor
- major
release-kind:
description: "Release kind"
required: false
type: choice
default: alpha
options:
- alpha
- beta
- rc
- stable
package:
description: "Which package to release"
required: true
type: choice
options:
- python_host
- nodejs_host
- cloudflare_worker_host
jobs:
core:
name: Core WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build_core
with:
CARGO_PROFILE: 'release'
CORE_WASM: 'upload'
host-nodejs-prepare:
name: Prepare Node.js Host
needs: [core]
if: ${{ !cancelled() && needs.core.result == 'success' && inputs.package == 'nodejs_host' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/nodejs_host
PACKAGE_TAG: nodejs
outputs:
RELEASE_VERSION: ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
RELEASE_LEVEL: ${{ steps.prepare_package.outputs.RELEASE_LEVEL }}
RELEASE_TAG: ${{ steps.prepare_package.outputs.RELEASE_TAG }}
RELEASE_PREID: ${{ steps.prepare_package.outputs.RELEASE_PREID }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/package_prepare
id: prepare_package
with:
RELEASE_LEVEL: ${{ inputs.release-level }}
RELEASE_KIND: ${{ inputs.release-kind }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Update version in package.json
working-directory: ${{ env.PACKAGE_PATH }}
run: yarn version --no-git-tag-version --new-version ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
- name: Commit package.json, VERSION, CHANGELOG.md and create git tag
working-directory: ${{ env.PACKAGE_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add package.json VERSION CHANGELOG.md
git commit -m "chore: release ${{ env.PACKAGE_PATH }} ${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git tag "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
body: ${{ steps.prepare_package.outputs.CHANGELOG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
host-nodejs-publish:
name: Publish Node.js Host
needs: [core, host-nodejs-prepare]
if: ${{ !cancelled() && needs.host-nodejs-prepare.result == 'success' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/nodejs_host
steps:
# Setup
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
# Build
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Copy LICENSE
run: cp LICENSE ${{ env.PACKAGE_PATH }}/LICENSE
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
# Publish
- name: Publish to NPM registry
working-directory: ${{ env.PACKAGE_PATH }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_BOT_PAT }}
run: yarn publish --verbose --no-git-tag-version --access public --new-version ${{ needs.host-nodejs-prepare.outputs.RELEASE_VERSION }} --tag ${{ needs.host-nodejs-prepare.outputs.RELEASE_TAG }}
host-cfw-prepare:
name: Prepare Cloudflare worker Host
needs: [core]
if: ${{ !cancelled() && needs.core.result == 'success' && inputs.package == 'cloudflare_worker_host' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/cloudflare_worker_host
PACKAGE_TAG: cfw
outputs:
RELEASE_VERSION: ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
RELEASE_LEVEL: ${{ steps.prepare_package.outputs.RELEASE_LEVEL }}
RELEASE_TAG: ${{ steps.prepare_package.outputs.RELEASE_TAG }}
RELEASE_PREID: ${{ steps.prepare_package.outputs.RELEASE_PREID }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/package_prepare
id: prepare_package
with:
RELEASE_LEVEL: ${{ inputs.release-level }}
RELEASE_KIND: ${{ inputs.release-kind }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Update version in package.json
working-directory: ${{ env.PACKAGE_PATH }}
run: yarn version --no-git-tag-version --new-version ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
- name: Commit package.json, VERSION, CHANGELOG.md and create git tag
working-directory: ${{ env.PACKAGE_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add package.json VERSION CHANGELOG.md
git commit -m "chore: release ${{ env.PACKAGE_PATH }} ${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git tag "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
body: ${{ steps.prepare_package.outputs.CHANGELOG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
host-cfw-publish:
name: Publish Cloudflare worker Host
needs: [core, host-cfw-prepare]
if: ${{ !cancelled() && needs.host-cfw-prepare.result == 'success' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/cloudflare_worker_host
steps:
# Setup
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
# Build
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Copy LICENSE
run: cp LICENSE ${{ env.PACKAGE_PATH }}/LICENSE
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
# Publish
- name: Publish to NPM registry
working-directory: ${{ env.PACKAGE_PATH }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_BOT_PAT }}
run: yarn publish --verbose --no-git-tag-version --access public --new-version ${{ needs.host-cfw-prepare.outputs.RELEASE_VERSION }} --tag ${{ needs.host-cfw-prepare.outputs.RELEASE_TAG }}
host-python-prepare:
name: Prepare Python Host
needs: [core]
if: ${{ !cancelled() && needs.core.result == 'success' && inputs.package == 'python_host' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/python_host
PACKAGE_TAG: python
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/package_prepare
id: prepare_package
with:
RELEASE_LEVEL: ${{ inputs.release-level }}
RELEASE_KIND: ${{ inputs.release-kind }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Python tools
run: python -m pip install build toml-cli
- uses: actions/download-artifact@v4
with:
name: core-wasm
path: ${{ env.PACKAGE_PATH }}/src/one_sdk/assets
- name: Update version in pyproject
working-directory: ${{ env.PACKAGE_PATH }}
run: toml set --toml-path pyproject.toml project.version ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
- name: Build packages/python_host
working-directory: ${{ env.PACKAGE_PATH }}
run: python -m build
- name: Commit pyproject.toml, VERSION, CHANGELOG.md and create git tag
working-directory: ${{ env.PACKAGE_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add pyproject.toml VERSION CHANGELOG.md
git commit -m "chore: release ${{ env.PACKAGE_PATH }} ${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git tag "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
body: ${{ steps.prepare_package.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
host-python-publish:
name: Publish Python Host
needs: [core, host-python-prepare]
if: ${{ !cancelled() && needs.host-python-prepare.result == 'success' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/python_host
steps:
# Setup
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Python tools
run: python -m pip install build toml-cli
# Build
- uses: actions/download-artifact@v4
with:
name: core-wasm
path: ${{ env.PACKAGE_PATH }}/src/one_sdk/assets
- name: Copy LICENSE
run: cp LICENSE ${{ env.PACKAGE_PATH }}/LICENSE
- name: Build ${{ env.PACKAGE_PATH }}
working-directory: ${{ env.PACKAGE_PATH }}
run: python -m build
# Publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ env.PACKAGE_PATH }}/dist
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
trigger_daily:
name: Trigger daily build
needs: [host-nodejs-publish, host-python-publish]
if: ${{ !cancelled() && (needs.host-nodejs-publish.result == 'success' || needs.host-python-publish.result == 'success') }}
runs-on: ubuntu-latest
steps:
- name: Trigger Daily Test
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_BOT_PAT }}
repository: superfaceai/superface-daily
event-type: on-demand-test