Skip to content

Commit

Permalink
暂时移除 mac 证书处理
Browse files Browse the repository at this point in the history
  • Loading branch information
Ming authored and Ming committed Feb 22, 2025
1 parent a061916 commit 778bdf6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 66 deletions.
20 changes: 2 additions & 18 deletions .electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @type {() => import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/

require('dotenv').config();
function getBuildTime() {
return process.env.BUILD_TIME || new Date().getTime();
}
Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = async function () {
// macOS 基础配置(本地构建使用)
config.mac = {
icon: 'buildResources/icon.icns',
identity: null, // 本地构建不签名
identity: null,
target: [
{
target: 'dmg',
Expand Down Expand Up @@ -146,21 +146,5 @@ module.exports = async function () {
releaseType: 'draft',
};

// CI 环境特定配置(GitHub Actions 使用)
if (process.env.CI && process.platform === 'darwin') {
config.mac = {
...config.mac, // 保留基础配置
identity: process.env.APPLE_IDENTITY, // CI 环境使用签名
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: 'buildResources/entitlements.mac.plist',
entitlementsInherit: 'buildResources/entitlements.mac.plist',
signIgnore: [
'node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node',
'node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-x64/node_sqlite3.node',
],
};
}

return config;
};
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,5 @@ jobs:
dry-run: ${{ github.event_name != 'push' || (github.ref_type != 'tag' && github.ref_name != 'main') }}
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
VITE_APP_API: ${{ secrets.VITE_APP_API }}
VITE_START_PAGE_URL: ${{ secrets.VITE_START_PAGE_URL }}
42 changes: 0 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,48 +164,6 @@ jobs:
echo "VITE_APP_API=${{ secrets.VITE_APP_API }}" > .env.production.local
echo "VITE_START_PAGE_URL=${{ secrets.VITE_START_PAGE_URL }}" >> .env.production.local
- name: Install Apple certificates
if: matrix.os == 'macos-latest'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
run: |
CERTIFICATE_PATH=$HOME/certificates
KEYCHAIN_PATH=$HOME/Library/Keychains/build.keychain-db
mkdir -p $CERTIFICATE_PATH
# 输出证书长度(不要显示内容)
echo "Certificate length: ${#BUILD_CERTIFICATE_BASE64}"
# 使用 -D 参数进行解码
echo "$BUILD_CERTIFICATE_BASE64" | base64 -D > $CERTIFICATE_PATH/certificate.p12
# 检查证书文件
ls -l $CERTIFICATE_PATH/certificate.p12
# 创建并配置钥匙串
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
# 导入证书
security import $CERTIFICATE_PATH/certificate.p12 -k build.keychain -P "$P12_PASSWORD" -T /usr/bin/codesign
# 列出所有身份
echo "All identities in keychain:"
security find-identity -v -p codesigning build.keychain
# 设置钥匙串访问权限
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
# 尝试查找特定证书
echo "Looking for specific certificate: $APPLE_IDENTITY"
security find-certificate -a -c "$APPLE_IDENTITY" -Z build.keychain || true
- name: Build Project
run: |
npm run build
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 778bdf6

Please sign in to comment.