-
Notifications
You must be signed in to change notification settings - Fork 3
104 lines (91 loc) · 3.16 KB
/
release.yml
File metadata and controls
104 lines (91 loc) · 3.16 KB
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
name: Build
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-release:
name: Build Project and Create Release
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6.0.0
- name: Node
uses: actions/setup-node@v6.0.0
with:
node-version: "20.19.6"
# 读取 package.json 里的 version 和 changelog 作为 app/manifest 里的配置
- name: Get version
id: read_version
run: |
VERSION=$(jq -r '.version' package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update version in manifest file
run: |
sed -i '' "s|version=0.0.1|version=${{ steps.read_version.outputs.version }}|" app/manifest
- name: Get changelog
id: read_log
run: |
CHANGELOG=$(jq -r '.changelog' package.json)
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
- name: Update changelog in manifest file
run: |
sed -i '' "s|changelog=changelog|changelog=${{ steps.read_log.outputs.changelog }}|" app/manifest
# 读取 CHANGELOG.md 里的更新记录
- name: Get changelog body
id: read_changelog
run: |
awk -v ver="${{ steps.read_version.outputs.version }}" '
/^## / {
if (found) exit
if ($0 ~ "^## " ver "( |$)" ) { found=1; next }
next
}
found { print }
' CHANGELOG.md >> RELEASE.md
# 查看 RELEASE.md
- name: RELEASE.md
run: cat RELEASE.md
# 安装所有依赖
- name: Install
run: npm run install
# 打包前端代码
- name: Build frontend
run: npm run build:frontend
# 打包 x86 文件
- name: Build x86 backend
run: npm run build:backend
- name: Build x86 package
run: |
chmod +x ./build/fnpack-1.2.0-darwin-arm64
./build/fnpack-1.2.0-darwin-arm64 build app
- name: Rename x86 package
run: mv code.editor.fpk code.editor.${{ steps.read_version.outputs.version}}.x86.fpk
# 打包 arm 文件
- name: Build arm backend
run: npm run build:backend:arm
- name: Update arm platform in manifest file
run: |
sed -i '' "s|platform=x86|platform=arm|" app/manifest
- name: Build arm package
run: |
chmod +x ./build/fnpack-1.2.0-darwin-arm64
./build/fnpack-1.2.0-darwin-arm64 build app
- name: Rename arm package
run: mv code.editor.fpk code.editor.${{ steps.read_version.outputs.version}}.arm.fpk
# 发布文件
- name: Release
uses: ncipollo/release-action@v1.20.0
with:
tag: v${{ steps.read_version.outputs.version}}
name: v${{ steps.read_version.outputs.version}}
bodyFile: RELEASE.md
artifacts: "code.editor.${{ steps.read_version.outputs.version}}.x86.fpk,code.editor.${{ steps.read_version.outputs.version}}.arm.fpk"
token: ${{ secrets.GITHUB_TOKEN }}
# 查看所有文件
- name: Files
run: ls