Skip to content

Commit

Permalink
chore: update electron-builder config
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Feb 9, 2023
1 parent 663e7f9 commit 036e568
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 44 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,42 +47,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Release for MacOS arm
if: matrix.os == 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
# echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
# mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
# cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
echo "${{ secrets.NOTARIZE_JS }}" > scripts/notarize.js
yarn release:m1
# clean up keychain and provisioning profile
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
- name: Release for MacOS x86
if: matrix.os == 'macos-12'
env:
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"electron:build:web": "yarn workspace postcat-web run build",
"electron:static": "npm run electron:tsc && electron .",
"release": "npm-run-all -s electron:build:web electron:tsc && npx esno scripts/build.ts --publish=always && node upload.js",
"release:m1": "npm-run-all -s electron:build:web electron:tsc && npx esno scripts/build.ts --publish=always onTagOrDraft && node upload.js",
"test": "npm-run-all --serial test:*",
"e2e": "yarn build:prod && npx playwright test -c e2e/playwright.config.ts e2e/",
"clear:electron:tsc": "tsc --build --clean",
Expand Down
20 changes: 13 additions & 7 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sign, doSign } from 'app-builder-lib/out/codeSign/windowsCodeSign';
import { build, DIR_TARGET, Platform } from 'electron-builder';
import type { Configuration, BuildResult } from 'electron-builder';
import { build, Platform } from 'electron-builder';
import type { Configuration } from 'electron-builder';
import minimist from 'minimist';

import { exec, spawn } from 'node:child_process';
Expand Down Expand Up @@ -93,11 +93,17 @@ const config: Configuration = {
gatekeeperAssess: false,
entitlements: 'scripts/entitlements.mac.plist',
entitlementsInherit: 'scripts/entitlements.mac.plist',
// target: ['dmg', 'zip'],
target: {
target: 'dmg',
arch: ['x64', 'arm64']
}
// target: ['dmg', 'zip']
target: [
{
target: 'dmg',
arch: ['x64', 'arm64']
},
{
target: 'zip',
arch: ['x64', 'arm64']
}
]
},
dmg: {
sign: false
Expand Down

0 comments on commit 036e568

Please sign in to comment.