Skip to content

Commit bc6be4b

Browse files
author
Hommy
committed
删除掉绿色包的打包逻辑
1 parent da1a1aa commit bc6be4b

4 files changed

Lines changed: 21 additions & 95 deletions

File tree

‎.github/workflows/desktop-client-dev.yml‎

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,15 @@ jobs:
5151
- os: windows-2022
5252
platform: win
5353
artifact_name: windows-build
54-
build_command: build-win
5554
installer_command: build-win-installer
56-
green_command: build-win-green
5755
- os: macos-14
5856
platform: mac
5957
artifact_name: macos-build
60-
build_command: build-mac
6158
installer_command: build-mac-installer
62-
green_command: build-mac-green
6359
- os: macos-15-intel
6460
platform: mac-x64
6561
artifact_name: macos-build-x64
66-
build_command: build-mac-x64
6762
installer_command: build-mac-x64-installer
68-
green_command: build-mac-x64-green
6963

7064
steps:
7165
- name: 准备代码
@@ -141,7 +135,7 @@ jobs:
141135
rm -f "$CERTIFICATE_PATH"
142136
143137
- name: 根据平台创建安装包
144-
timeout-minutes: 60
138+
timeout-minutes: 75
145139
working-directory: ./desktop-client
146140
env:
147141
# 不传 CSC_LINK:使用上一步导入的钥匙串,避免再建缺 codesign: 的临时钥匙串
@@ -157,23 +151,6 @@ jobs:
157151
npm run ${{ matrix.installer_command }}
158152
shell: bash
159153

160-
- name: 构建绿色安装包
161-
if: matrix.green_command != 'null'
162-
timeout-minutes: 60
163-
working-directory: ./desktop-client
164-
env:
165-
CSC_IDENTITY_AUTO_DISCOVERY: ${{ startsWith(matrix.os, 'macos') && 'true' || 'false' }}
166-
APPLE_ID: ${{ startsWith(matrix.os, 'macos') && secrets.APPLE_ID || '' }}
167-
APPLE_APP_SPECIFIC_PASSWORD: ${{ startsWith(matrix.os, 'macos') && secrets.APPLE_APP_SPECIFIC_PASSWORD || '' }}
168-
APPLE_TEAM_ID: ${{ startsWith(matrix.os, 'macos') && secrets.APPLE_TEAM_ID || '' }}
169-
run: |
170-
if [ -n "${KEYCHAIN_PATH:-}" ]; then
171-
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
172-
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
173-
fi
174-
npm run ${{ matrix.green_command }}
175-
shell: bash
176-
177154
- name: 清理 macOS 签名钥匙串
178155
if: always() && startsWith(matrix.os, 'macos')
179156
run: |
@@ -194,14 +171,6 @@ jobs:
194171
path: desktop-client/dist/
195172
if-no-files-found: ignore
196173

197-
- name: 上传绿色安装包构件
198-
if: matrix.green_command != 'null'
199-
uses: actions/upload-artifact@v4
200-
with:
201-
name: ${{ matrix.artifact_name }}-green
202-
path: desktop-client/dist/*.zip
203-
if-no-files-found: ignore
204-
205174
- name: 发布版本
206175
if: startsWith(github.ref, 'refs/tags/v')
207176
uses: softprops/action-gh-release@v1
@@ -212,7 +181,6 @@ jobs:
212181
desktop-client/dist/capcut-mate-windows-x64-installer.exe
213182
desktop-client/dist/capcut-mate-macos-arm64-installer.dmg
214183
desktop-client/dist/capcut-mate-macos-x64-installer.dmg
215-
desktop-client/dist/*.zip
216184
overwrite: true
217185
env:
218186
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎desktop-client/package.json‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
"build-mac-x64": "electron-packager . CapCut-Mate --platform=darwin --arch=x64 --out dist --overwrite --icon=assets/icons/logo.icns --ignore=.gitignore --ignore=.github --ignore=README.md --ignore=scripts --ignore=web",
1515
"build-win-installer": "electron-builder --win nsis --x64 --config ./scripts/electron-builder.config.js --publish never",
1616
"build-mac-installer": "electron-builder --mac --arm64 --config ./scripts/electron-builder.config.js --publish never",
17-
"build-mac-x64-installer": "electron-builder --mac --x64 --config ./scripts/electron-builder.config.js --publish never",
18-
"build-win-green": "electron-builder --win zip --x64 --config ./scripts/electron-builder-green.config.js --publish never",
19-
"build-mac-green": "electron-builder --mac zip --arm64 --config ./scripts/electron-builder-green.config.js --publish never",
20-
"build-mac-x64-green": "electron-builder --mac zip --x64 --config ./scripts/electron-builder-green.config.js --publish never"
17+
"build-mac-x64-installer": "electron-builder --mac --x64 --config ./scripts/electron-builder.config.js --publish never"
2118
},
2219
"devDependencies": {
2320
"@electron/notarize": "^3.1.1",

‎desktop-client/scripts/electron-builder-green.config.js‎

Lines changed: 0 additions & 48 deletions
This file was deleted.

‎desktop-client/scripts/notarize.js‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
const path = require("path");
66
const { execFileSync } = require("child_process");
77

8-
function loadNotarize() {
9-
return require("@electron/notarize");
10-
}
11-
128
module.exports = async function notarizeAfterSign(context) {
139
const { electronPlatformName, appOutDir } = context;
1410
if (electronPlatformName !== "darwin") return;
@@ -21,32 +17,45 @@ module.exports = async function notarizeAfterSign(context) {
2117
return;
2218
}
2319

24-
const { notarize } = loadNotarize();
20+
// 长时间打包后钥匙串可能再次上锁,公证前先解锁
21+
const keychainPath = process.env.KEYCHAIN_PATH;
22+
const keychainPassword = process.env.KEYCHAIN_PASSWORD;
23+
if (keychainPath && keychainPassword) {
24+
try {
25+
execFileSync("security", ["unlock-keychain", "-p", keychainPassword, keychainPath], {
26+
stdio: "inherit"
27+
});
28+
} catch (err) {
29+
console.warn("unlock-keychain failed:", err && err.message ? err.message : err);
30+
}
31+
}
32+
33+
const { notarize } = require("@electron/notarize");
2534
const appName = context.packager.appInfo.productFilename;
2635
const appPath = path.join(appOutDir, `${appName}.app`);
2736

2837
const maxAttempts = 5;
2938
let lastError;
3039

3140
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
41+
const started = Date.now();
3242
try {
3343
console.log(`notarizing ${appPath} (attempt ${attempt}/${maxAttempts})`);
44+
// @electron/notarize v3:提交公证并自动 staple
3445
await notarize({
3546
appPath,
3647
appleId,
3748
appleIdPassword,
3849
teamId
3950
});
40-
console.log("notarization successful, stapling...");
41-
execFileSync("xcrun", ["stapler", "staple", "-v", appPath], { stdio: "inherit" });
42-
console.log("staple successful");
51+
console.log(`notarization successful in ${Math.round((Date.now() - started) / 1000)}s`);
4352
return;
4453
} catch (err) {
4554
lastError = err;
4655
const message = err && err.message ? err.message : String(err);
47-
console.warn(`notarize attempt ${attempt} failed: ${message}`);
56+
console.warn(`notarize attempt ${attempt} failed after ${Math.round((Date.now() - started) / 1000)}s: ${message}`);
4857
if (attempt < maxAttempts) {
49-
const waitSec = attempt * 45;
58+
const waitSec = attempt * 60;
5059
console.log(`waiting ${waitSec}s before retry...`);
5160
await new Promise((resolve) => setTimeout(resolve, waitSec * 1000));
5261
}

0 commit comments

Comments
 (0)