-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (62 loc) · 1.97 KB
/
release.yaml
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
name: Build and Release
on:
push:
branches:
- main
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm install
- name: Run build script
run: npm run build
- name: Install ncc
run: npm install @vercel/ncc -g
- name: Build with ncc
run: ncc build dist/index.js -o package
- name: Package with pkg
run: npx pkg package/index.js --targets node16-linux,node16-macos,node16-win -o package/chaoxing
- name: Capture the version tag
id: vars
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Rename artifacts to include version number
run: |
mv package/chaoxing-linux package/chaoxing-linux-${{ env.tag }}
mv package/chaoxing-macos package/chaoxing-macos-${{ env.tag }}
mv package/chaoxing-win.exe package/chaoxing-win-${{ env.tag }}.exe
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: chaoxing-${{ env.tag }}
path: |
package/chaoxing-linux-${{ env.tag }}
package/chaoxing-macos-${{ env.tag }}
package/chaoxing-win-${{ env.tag }}.exe
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Capture the version tag
id: vars
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Download Artifacts
uses: actions/[email protected]
with:
name: chaoxing-${{ env.tag }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
chaoxing-linux-${{ env.tag }}
chaoxing-macos-${{ env.tag }}
chaoxing-win-${{ env.tag }}.exe
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}