Skip to content

Commit 681f2ad

Browse files
author
xcodebuild
committed
build for Apple M1
1 parent 92a6de3 commit 681f2ad

File tree

5 files changed

+120
-51
lines changed

5 files changed

+120
-51
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
os: [macos-latest, windows-latest]
11+
os: [macos-latest, windows-latest, macos-10.15]
1212

1313
steps:
1414
- name: Check out Git repository
@@ -20,11 +20,13 @@ jobs:
2020
node-version: 14
2121

2222
- name: Install deps
23+
if: matrix.os != 'macos-10.15'
2324
run: |
2425
npm run install-deps
2526
2627
- name: Build/release Electron app
2728
uses: samuelmeuli/action-electron-builder@v1
29+
if: matrix.os != 'macos-10.15'
2830
with:
2931
# GitHub token, automatically provided to the action
3032
# (No need to define this secret in the repo settings)
@@ -34,3 +36,23 @@ jobs:
3436
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
3537
mac_certs: ${{ secrets.mac_certs }}
3638
mac_certs_password: ${{ secrets.mac_certs_password }}
39+
args: --x64
40+
41+
- name: Install deps for M1
42+
if: matrix.os == 'macos-10.15'
43+
run: |
44+
env IS_ARM=1 npm run install-deps
45+
46+
- name: Build/release Electron app for M1
47+
uses: samuelmeuli/action-electron-builder@v1
48+
if: matrix.os == 'macos-10.15'
49+
with:
50+
# GitHub token, automatically provided to the action
51+
# (No need to define this secret in the repo settings)
52+
github_token: ${{ secrets.github_token }}
53+
# If the commit is tagged with a version (e.g. "v1.0.0"),
54+
# release the app after building
55+
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
56+
mac_certs: ${{ secrets.mac_certs }}
57+
mac_certs_password: ${{ secrets.mac_certs_password }}
58+
args: --arm64

.github/workflows/ci.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
os: [windows-latest, macos-latest]
17+
os: [windows-latest, macos-latest, macos-10.15]
1818
runs-on: ${{ matrix.os }}
1919
steps:
2020
- name: Check out Git repository
@@ -26,10 +26,17 @@ jobs:
2626
node-version: 14
2727

2828
- name: Install deps
29+
if: matrix.os != 'macos-10.15'
2930
run: |
3031
npm run install-deps
3132
npm run dateversion
3233
34+
- name: Install deps for M1
35+
if: matrix.os == 'macos-10.15'
36+
run: |
37+
env IS_ARM=1 npm run install-deps
38+
npm run dateversion
39+
3340
- name: build windows app
3441
if: matrix.os == 'windows-latest'
3542
run: |
@@ -44,6 +51,13 @@ jobs:
4451
env:
4552
GH_TOKEN: ${{ secrets.github_token }}
4653

54+
- name: build mac app for M1
55+
if: matrix.os == 'macos-10.15'
56+
run: |
57+
npm run dist:mac-arm
58+
env:
59+
GH_TOKEN: ${{ secrets.github_token }}
60+
4761
- name: upload windows app
4862
if: matrix.os == 'windows-latest'
4963
uses: actions/upload-artifact@v2
@@ -55,5 +69,12 @@ jobs:
5569
if: matrix.os == 'macos-latest'
5670
uses: actions/upload-artifact@v2
5771
with:
58-
name: iProxyTesting-${{ runner.OS }}
72+
name: iProxyTesting-Intel-${{ runner.OS }}
73+
path: release/*.dmg
74+
75+
- name: upload mac app for M1
76+
if: matrix.os == 'macos-10.15'
77+
uses: actions/upload-artifact@v2
78+
with:
79+
name: iProxyTesting-Apple-${{ runner.OS }}
5980
path: release/*.dmg

.github/workflows/nightly.yml

Lines changed: 66 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,69 @@ on:
66

77
jobs:
88
build:
9-
strategy:
10-
matrix:
11-
os: [windows-latest, macos-latest]
12-
runs-on: ${{ matrix.os }}
13-
steps:
14-
- name: Check out Git repository
15-
uses: actions/checkout@v1
16-
17-
- name: Install Node.js, NPM and Yarn
18-
uses: actions/setup-node@v1
19-
with:
20-
node-version: 14
21-
22-
- name: Install deps
23-
run: |
24-
npm run install-deps
25-
npm run nightlyversion
26-
27-
- name: build windows app
28-
if: matrix.os == 'windows-latest'
29-
run: |
30-
npm run dist:win
31-
env:
32-
GH_TOKEN: ${{ secrets.github_token }}
33-
34-
- name: build mac app
35-
if: matrix.os == 'macos-latest'
36-
run: |
37-
npm run dist:mac
38-
env:
39-
GH_TOKEN: ${{ secrets.github_token }}
40-
41-
- name: upload windows app
42-
if: matrix.os == 'windows-latest'
43-
uses: actions/upload-artifact@v2
44-
with:
45-
name: iProxyNightly-${{ runner.OS }}
46-
path: release/*.exe
47-
48-
- name: upload mac app
49-
if: matrix.os == 'macos-latest'
50-
uses: actions/upload-artifact@v2
51-
with:
52-
name: iProxyNightly-${{ runner.OS }}
53-
path: release/*.dmg
9+
strategy:
10+
matrix:
11+
os: [windows-latest, macos-latest, macos-10.15]
12+
runs-on: ${{ matrix.os }}
13+
steps:
14+
- name: Check out Git repository
15+
uses: actions/checkout@v1
16+
17+
- name: Install Node.js, NPM and Yarn
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 14
21+
22+
- name: Install deps
23+
if: matrix.os != 'macos-10.15'
24+
run: |
25+
npm run install-deps
26+
npm run nightlyversion
27+
28+
- name: Install deps for M1
29+
if: matrix.os == 'macos-10.15'
30+
run: |
31+
env IS_ARM=1 npm run install-deps
32+
npm run nightlyversion
33+
34+
- name: build windows app
35+
if: matrix.os == 'windows-latest'
36+
run: |
37+
npm run dist:win
38+
env:
39+
GH_TOKEN: ${{ secrets.github_token }}
40+
41+
- name: build mac app
42+
if: matrix.os == 'macos-latest'
43+
run: |
44+
npm run dist:mac
45+
env:
46+
GH_TOKEN: ${{ secrets.github_token }}
47+
48+
- name: build mac app for M1
49+
if: matrix.os == 'macos-10.15'
50+
run: |
51+
npm run dist:mac-arm
52+
env:
53+
GH_TOKEN: ${{ secrets.github_token }}
54+
55+
- name: upload windows app
56+
if: matrix.os == 'windows-latest'
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: iProxyNightly-${{ runner.OS }}
60+
path: release/*.exe
61+
62+
- name: upload mac app
63+
if: matrix.os == 'macos-latest'
64+
uses: actions/upload-artifact@v2
65+
with:
66+
name: iProxyNightly-Intel-${{ runner.OS }}
67+
path: release/*.dmg
68+
69+
- name: upload mac app for M1
70+
if: matrix.os == 'macos-10.15'
71+
uses: actions/upload-artifact@v2
72+
with:
73+
name: iProxyNightly-Apple-${{ runner.OS }}
74+
path: release/*.dmg

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"compile": "yarn run lint && yarn run compile-main && yarn run compile-renderer",
1313
"build": "yarn clean:dist && yarn syncversion && yarn compile ",
1414
"dist": "yarn run build && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --mac --win --x64 --publish never",
15-
"dist:mac": "yarn run build && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --mac --universal",
15+
"dist:mac": "yarn run build && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --mac --x64",
16+
"dist:mac-arm": "yarn run build && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --mac --arm64",
1617
"dist:win": "yarn run build && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --win --x64",
1718
"dist-codesign": "yarn run build && electron-builder --mac --win --x64 --publish never",
1819
"pack": "yarn dist --dir -c.compression=store -c.mac.identity=null",

scripts/update-node.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ const shell = require('shelljs');
66
const systemType = os.type();
77
const SYSTEM_IS_MACOS = systemType === 'Darwin';
88

9+
const VERSION = 'v16.4.2';
10+
11+
const IS_ARM = process.env.IS_ARM === '1';
12+
913
if (SYSTEM_IS_MACOS) {
10-
shell.exec(`cd vendor/files/node && curl https://cdn.npm.taobao.org/dist/node/v15.12.0/node-v15.12.0-darwin-x64.tar.gz| tar -xz && mv node-*-darwin-x64/bin/node node-mac && rm -rf node-*-darwin-x64`);
14+
shell.exec(`cd vendor/files/node && curl https://cdn.npm.taobao.org/dist/node/${VERSION}/node-${VERSION}-darwin-${IS_ARM ? 'arm64': 'x64'}.tar.gz| tar -xz && mv node-*-darwin-*/bin/node node-mac && rm -rf node-*-darwin-*`);
1115
} else {
12-
shell.exec(`cd vendor/files/node && curl https://cdn.npm.taobao.org/dist/node/v14.15.3/win-x86/node.exe > node-win.exe`)
16+
shell.exec(`cd vendor/files/node && curl https://cdn.npm.taobao.org/dist/node/${VERSION}/win-x86/node.exe > node-win.exe`)
1317
}

0 commit comments

Comments
 (0)