-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
812 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
name: Test Mac Code Signing | ||
|
||
on: | ||
push: | ||
branches: | ||
- "chore/sign-mac-ci" | ||
|
||
jobs: | ||
build_yakit: | ||
runs-on: macos-13 | ||
env: | ||
CI: "" | ||
NODE_OPTIONS: --max_old_space_size=4096 | ||
APPLE_ID: ${{ secrets.APPLE_ACCOUNT_EMAIL }} | ||
TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | ||
APPLE_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }} | ||
CERT_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} | ||
CERT_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.18.2 | ||
|
||
- run: echo ${{ github.ref }} | ||
- run: cp buildutil/zip /usr/local/bin/zip | ||
- run: chmod +x /usr/local/bin/zip | ||
- run: zip -h | ||
|
||
- name: "Fetch Latest EngineVersion" | ||
run: wget -O bins/engine-version.txt https://oss-qn.yaklang.com/yak/latest/version.txt | ||
- run: | | ||
cat bins/engine-version.txt | ||
YAK_VERSION=$(cat bins/engine-version.txt | tr -d '\n') | ||
echo "ENGINE_VERSION=$YAK_VERSION" >> $GITHUB_ENV | ||
- name: "Download Yak Engine via wget(Linux)" | ||
id: download-linux-engine | ||
run: wget -O bins/yak_linux_amd64 https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_linux_amd64 && zip ./bins/yak_linux_amd64.zip ./bins/yak_linux_amd64 && rm ./bins/yak_linux_amd64 | ||
- name: "Download Yak Engine via wget(Linux-arm64)" | ||
id: download-linux-engine-arm64 | ||
run: wget -O bins/yak_linux_arm64 https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_linux_arm64 && zip ./bins/yak_linux_arm64.zip ./bins/yak_linux_arm64 && rm ./bins/yak_linux_arm64 | ||
|
||
- name: "Download Yak Engine via wget(Windows)" | ||
id: download-windows-engine | ||
run: wget -O bins/yak_windows_amd64.exe https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_windows_amd64.exe && zip ./bins/yak_windows_normal_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe | ||
- name: "Download Yak Legacy Engine via wget(Windows)" | ||
id: download-windows-leagacy-engine | ||
run: wget -O bins/yak_windows_amd64.exe https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_windows_legacy_amd64.exe && zip ./bins/yak_windows_legacy_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe | ||
|
||
- name: "Download Yak Engine via wget(MacOS)" | ||
id: download-darwin-engine | ||
run: wget -O bins/yak_darwin_amd64 https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_darwin_amd64 | ||
- name: "Download Yak Engine via wget(MacOS-arm64)" | ||
id: download-darwin-engine-arm64 | ||
run: wget -O bins/yak_darwin_arm64 https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_darwin_arm64 | ||
- name: Import Signing Certificate | ||
run: chmod +x ./packageScript/script/signature.sh && ./packageScript/script/signature.sh | ||
shell: bash | ||
- name: "Fetch Mac-Amd Sha256" | ||
run: wget -O bins/yak_darwin_amd64.sha256.txt https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_darwin_amd64.sha256.txt | ||
- name: "Fetch Mac-Arm Sha256" | ||
run: wget -O bins/yak_darwin_arm64.sha256.txt https://oss-qn.yaklang.com/yak/${ENGINE_VERSION}/yak_darwin_arm64.sha256.txt | ||
|
||
- name: Extract Package.json Version | ||
id: extract_version | ||
uses: Saionaro/extract-package-version@v1.1.1 | ||
- name: Crop Yakit-CE Package.json Version | ||
uses: mad9000/actions-find-and-replace-string@5 | ||
id: package_ce_version | ||
with: | ||
source: ${{ steps.extract_version.outputs.version }} | ||
find: "-ce" | ||
replace: "" | ||
- name: Crop Yakit-EE Package.json Version | ||
uses: mad9000/actions-find-and-replace-string@5 | ||
id: package_version | ||
with: | ||
source: ${{ steps.package_ce_version.outputs.value }} | ||
find: "-ee" | ||
replace: "" | ||
- name: Echo Yakit Package Version | ||
run: echo "ENV_TAG=${{ steps.package_version.outputs.value }}" >> $GITHUB_ENV | ||
|
||
- run: yarn install | ||
working-directory: ./ | ||
name: "Install Dependencies" | ||
|
||
- name: Build Yakit Normal And Legacy (MultiPlatform) | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
working-directory: ./ | ||
run: chmod +x ./packageScript/script/electron-builder.sh && ./packageScript/script/electron-builder.sh | ||
shell: bash | ||
|
||
- name: View Published Content | ||
run: | ||
ls ./release | ||
# EnpriTraceAgent -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage) | ||
# EnpriTrace -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage) | ||
# Yakit -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage) | ||
|
||
- name: Check Yakit if the output is correct | ||
run: chmod +x ./scripts/check-build-package.sh && ./scripts/check-build-package.sh Yakit | ||
shell: bash | ||
- name: Upload Yakit(CE) Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Yakit-artifacts | ||
path: | | ||
./release/Yakit-${{ env.ENV_TAG }}-*.exe | ||
./release/Yakit-${{ env.ENV_TAG }}-*.dmg | ||
./release/Yakit-${{ env.ENV_TAG }}-*.AppImage | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- name: Check EnpriTrace if the output is correct | ||
run: ./scripts/check-build-package.sh EnpriTrace | ||
shell: bash | ||
- name: Upload Yakit(EE) Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: EnpriTrace-artifacts | ||
path: | | ||
./release/EnpriTrace-${{ env.ENV_TAG }}-*.exe | ||
./release/EnpriTrace-${{ env.ENV_TAG }}-*.dmg | ||
./release/EnpriTrace-${{ env.ENV_TAG }}-*.AppImage | ||
if-no-files-found: error | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { notarize } = require("@electron/notarize"); | ||
|
||
module.exports = async function afterSign(context) { | ||
const { appOutDir, packager, electronPlatformName } = context; | ||
if (electronPlatformName !== "darwin") { | ||
return; | ||
} | ||
const appName = packager.appInfo.productFilename; | ||
const appBundleId = packager.appInfo.id; | ||
|
||
console.log(`开始对 ${appName} 进行公证,输出目录:${appOutDir}`, `app 所处路径: ${appOutDir}/${appName}.app`); | ||
|
||
return await notarize({ | ||
appBundleId: appBundleId, | ||
appPath: `${appOutDir}/${appName}.app`, | ||
appleId: process.env.APPLE_ID, | ||
appleIdPassword: process.env.APPLE_PASSWORD, | ||
teamId: process.env.TEAM_ID, // 可选,根据需要配置 | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
const packageJson = require("../../package.json"); | ||
|
||
module.exports = async function (context) { | ||
const isLegacy = process.env.THE_LEGACY == "true"; | ||
const archMap = { | ||
1: "x64", | ||
3: "arm64", | ||
}; | ||
const arch = archMap[context.arch]; | ||
const baseInfo = context.packager.appInfo; | ||
let productVersion = packageJson.version || baseInfo.version; | ||
// CE | ||
if (productVersion.endsWith("-ce")) { | ||
productVersion = productVersion.replace("-ce", ""); | ||
} | ||
// EE | ||
if (productVersion.endsWith("-ee")) { | ||
productVersion = productVersion.replace("-ee", ""); | ||
} | ||
|
||
/** win32 */ | ||
const win32Config = context.electronPlatformName === "win32" ? context.packager.config.win : null; | ||
if (win32Config) { | ||
win32Config.extraFiles = [ | ||
{ | ||
from: "bins/flag.windows.txt", | ||
to: "bins/flag.windows.txt", | ||
}, | ||
{ | ||
from: "bins/yak_windows_amd64.zip", | ||
to: "bins/yak.zip", | ||
}, | ||
]; | ||
win32Config.artifactName = `${"${productName}"}-${productVersion}-windows${ | ||
isLegacy ? "-legacy" : "" | ||
}-amd64.${"${ext}"}`; | ||
context.packager.config.win = win32Config; | ||
} | ||
|
||
/**linux */ | ||
/** 1:x64 3:arm64 */ | ||
const linuxConfig = context.electronPlatformName === "linux" ? context.packager.config.linux : null; | ||
if (linuxConfig) { | ||
const linuxExtraFiles = [ | ||
{ | ||
from: "bins/flag.linux.txt", | ||
to: "bins/flag.linux.txt", | ||
}, | ||
]; | ||
switch (arch) { | ||
case "arm64": | ||
linuxConfig.artifactName = `${"${productName}"}-${productVersion}-linux${ | ||
isLegacy ? "-legacy" : "" | ||
}-arm64.${"${ext}"}`; | ||
linuxConfig.extraFiles = [ | ||
...linuxExtraFiles, | ||
{ | ||
from: "bins/yak_linux_arm64.zip", | ||
to: "bins/yak.zip", | ||
}, | ||
]; | ||
break; | ||
case "x64": | ||
linuxConfig.artifactName = `${"${productName}"}-${productVersion}-linux${ | ||
isLegacy ? "-legacy" : "" | ||
}-amd64.${"${ext}"}`; | ||
linuxConfig.extraFiles = [ | ||
...linuxExtraFiles, | ||
{ | ||
from: "bins/yak_linux_amd64.zip", | ||
to: "bins/yak.zip", | ||
}, | ||
]; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
context.packager.config.linux = linuxConfig; | ||
} | ||
|
||
/**mac */ | ||
/** 1:x64 3:arm64 */ | ||
const macConfig = context.electronPlatformName === "darwin" ? context.packager.config.mac : null; | ||
if (macConfig) { | ||
const darwinExtraFiles = [ | ||
{ | ||
from: "bins/flag.darwin.txt", | ||
to: "bins/flag.darwin.txt", | ||
}, | ||
]; | ||
macConfig.artifactName = `${"${productName}"}-${productVersion}-darwin${ | ||
isLegacy ? "-legacy" : "" | ||
}-${"${arch}"}.${"${ext}"}`; | ||
switch (arch) { | ||
case "arm64": | ||
macConfig.extraFiles = [ | ||
...darwinExtraFiles, | ||
{ | ||
from: "bins/yak_darwin_arm64.zip", | ||
to: "bins/yak.zip", | ||
}, | ||
{ | ||
from: "bins/yak_darwin_arm64.sha256.txt", | ||
to: "bins/engine-sha256.txt", | ||
}, | ||
]; | ||
break; | ||
case "x64": | ||
macConfig.extraFiles = [ | ||
...darwinExtraFiles, | ||
{ | ||
from: "bins/yak_darwin_amd64.zip", | ||
to: "bins/yak.zip", | ||
}, | ||
{ | ||
from: "bins/yak_darwin_amd64.sha256.txt", | ||
to: "bins/engine-sha256.txt", | ||
}, | ||
]; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
context.packager.config.mac = macConfig; | ||
} | ||
}; |
Oops, something went wrong.