feat: provide macos arm m1 package and sign it

This commit is contained in:
lin onetwo 2022-11-25 16:03:12 +08:00
parent dbce1debf5
commit b67d531ce0
3 changed files with 17 additions and 11 deletions

View file

@ -125,15 +125,14 @@ jobs:
CI: true
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Seems M1 can use x64 package, but arm package will show its broken
# - name: Make macOS (arm64)
# run: npm run make:mac-arm
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
# CI: true
# CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make macOS (arm64)
run: npm run make:mac-arm
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
CI: true
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1

View file

@ -11,6 +11,7 @@
"test-without-package": "mkdir -p logs && cross-env NODE_ENV=test cucumber-js",
"package": "npm run init:git-submodule && electron-forge package",
"make:mac-x64": "npm run init:git-submodule && cross-env NODE_ENV=production electron-forge make --platform=darwin --arch=x64",
"make:mac-arm": "npm run init:git-submodule && cross-env NODE_ENV=production electron-forge make --platform=darwin --arch=arm64",
"make:win-x64": "npm run init:git-submodule && cross-env NODE_ENV=production electron-forge make --platform=win32 --arch=x64",
"make:win-ia32": "npm run init:git-submodule && cross-env NODE_ENV=production electron-forge make --platform=win32 --arch=ia32",
"make:win-arm": "npm run init:git-submodule && cross-env NODE_ENV=production electron-forge make --platform=win32 --arch=arm64",

View file

@ -23,8 +23,10 @@ const keepingLprojRegEx = /(en|zh_CN)\.lproj/g;
* @returns
*/
exports.default = async (buildPath, electronVersion, platform, arch, callback) => {
const cwd = path.join(buildPath, '..');
const projectRoot = path.join(__dirname, '..');
const cwd = path.resolve(buildPath, '..');
const projectRoot = path.resolve(__dirname, '..');
const appParentPath = path.resolve(buildPath, '..', '..', '..', '..');
const appPath = path.join(appParentPath, 'Electron.app');
/** delete useless lproj files to make it clean */
const lproj = glob.sync('*.lproj', { cwd });
@ -48,6 +50,10 @@ exports.default = async (buildPath, electronVersion, platform, arch, callback) =
await exec(`npm i --legacy-building`, { cwd: path.join(cwd, 'node_modules', 'zx', 'node_modules', 'globby') });
await exec(`npm i --legacy-building --ignore-scripts`, { cwd: path.join(cwd, 'node_modules', 'zx', 'node_modules', 'node-fetch') });
}
/** sign it for mac m1 https://www.zhihu.com/question/431722091/answer/1592339574 */
if (platform === 'darwin') {
await exec(`xattr -rd com.apple.quarantine ${appPath}`, { cwd: appParentPath });
}
/** complete this hook */
callback();
};