-
Notifications
You must be signed in to change notification settings - Fork 98
67 lines (65 loc) · 2.79 KB
/
build-windows.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
name: CI-Windows
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching any tags
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
node-version: ['20.18.0']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# 获取package.json中的版本号, 方便后续处理
- name: Read package.json
uses: tyankatsu0105/read-package-version-actions@v1
id: package-version
- name: Show version number
run: echo "current version is ${{ steps.package-version.outputs.version }}"
- uses: pnpm/action-setup@v2
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
# 先执行electron的构建, 节约调试时间
- name: Install dependencies
run: pnpm install
# sharp需要单独安装
# - run: npm install --platform=win32 --arch=x64 sharp
# - run: npm rebuild --platform=win32 --arch=ia32 sharp
# - run: npm rebuild --platform=win32 --arch=arm sharp
# - run: npm rebuild --platform=win32 --arch=arm64 sharp
- run: cd ./client ; pnpm install ; cd ..
- run: pnpm build
env:
CI: true
CI_ENV: 'Github Action'
GH_TOKEN: ${{ secrets.GH_TOKEN }} # 在setting中配置自定义环境变量, 参考[此处](https://help.github.com/cn/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)
- name: Create Release
id: create_release
uses: monkeyWie/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: win-${{ steps.package-version.outputs.version }}
release_name: ${{ steps.package-version.outputs.version }}
draft: true
prerelease: true
- name: Upload Release normal windows
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./release/稳部落 Setup ${{ steps.package-version.outputs.version }}.exe
asset_name: stablog-win64-${{ steps.package-version.outputs.version }}.exe
asset_content_type: application/vnd.microsoft.portable-executable