-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (70 loc) · 2.56 KB
/
release.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
name: Release Package
on:
release:
types: [published]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Read package version
id: version
run: |
release_version=$(git describe --tags --abbrev=0)
package_version=$(node -p -e "require('./package.json').version")
if [ "$release_version" != "v$package_version" ]; then
echo "Error: Release version $release_version does not match package version $package_version"
exit 1
fi
echo "CURRENT_VERSION=$package_version" >> $GITHUB_ENV
- name: Install dependencies
run: npm ci
- name: "[protocol] Build and Publish"
run: |
cd protocol
npm run build
npm publish --access public
- name: "[server] Build and Publish"
run: |
cd server
npm run build
npm publish --access public
- name: "[client] Build"
run: |
cd client
npm run build
zip script-bridge-client-v${{ env.CURRENT_VERSION }}.zip build/script-bridge-client.js build/script-bridge-client.d.ts
- name: "[client] Upload Release Asset (JS)"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: client/build/script-bridge-client.js
asset_name: script-bridge-client.js
asset_content_type: application/javascript
- name: "[client] Upload Release Asset (DTS)"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: client/build/script-bridge-client.d.ts
asset_name: script-bridge-client.d.ts
asset_content_type: application/typescript
- name: "[client] Upload Release Asset (ZIP)"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: client/build/script-bridge-client-v${{ env.CURRENT_VERSION }}.zip
asset_name: script-bridge-client-v${{ env.CURRENT_VERSION }}.zip
asset_content_type: application/zip