-
Notifications
You must be signed in to change notification settings - Fork 98
68 lines (66 loc) · 2.78 KB
/
build-mac.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
name: CI-Mac-Total
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching any tags
jobs:
build:
runs-on: macos-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 }}"
# mac上需要预先安装vips库
# - run: brew install vips
# - run: brew install vips
# 先执行electron的构建, 节约调试时间
- 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'
- name: Install dependencies
- run: ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- run: pnpm install
# 只安装intel版的sharp库即可, m1上可以运行intel的代码
- run: pnpm install --platform=darwin --arch=x64 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: mac-${{ steps.package-version.outputs.version }}
release_name: ${{ steps.package-version.outputs.version }}
draft: true
prerelease: true
- name: Upload Release normal mac
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/稳部落-${{ steps.package-version.outputs.version }}.dmg
asset_name: stablog-mac-total-${{ steps.package-version.outputs.version }}.dmg
asset_content_type: application/zip