Skip to content

Commit

Permalink
cib打包mac和Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
luoluoTH committed Jul 3, 2024
1 parent 7fe5bfd commit 4cca20a
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 30 deletions.
59 changes: 54 additions & 5 deletions .github/workflows/yakit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@ jobs:
- name: "Download Yak Engine via wget(MacOS)"
id: download-darwin-engine
run: wget -O bins/yak_darwin_amd64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_darwin_amd64 && zip ./bins/yak_darwin_amd64.zip ./bins/yak_darwin_amd64 && rm ./bins/yak_darwin_amd64

- name: "Download Yak Engine via wget(MacOS-arm64)"
id: download-darwin-engine-arm64
run: wget -O bins/yak_darwin_arm64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_darwin_arm64 && zip ./bins/yak_darwin_arm64.zip ./bins/yak_darwin_arm64 && rm ./bins/yak_darwin_arm64

- name: "Download Yak Engine via wget(Linux)"
id: download-linux-engine
run: wget -O bins/yak_linux_amd64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/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://yaklang.oss-accelerate.aliyuncs.com/yak/latest/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://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_windows_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
Expand Down Expand Up @@ -141,13 +151,21 @@ jobs:
# Yakit-1.0.3-beta24-win32-x64.exe
name: Yakit-${{ steps.extract_version.outputs.version }}-darwin-x64.dmg
path: ./release/Yakit-${{ steps.extract_version.outputs.version }}-darwin-x64.dmg
- name: Upload Yakit(Community) Artifacts Linux
- name: Upload Yakit(Community) Artifacts Linux(amd64)
uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci/community-') }}
with:
# Yakit-1.0.3-beta24-win32-x64.exe
name: Yakit-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage
path: ./release/Yakit-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage

- name: Upload Yakit(Community) Artifacts Linux(arm64)
uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci/community-') }}
with:
name: Yakit-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage
path: ./release/Yakit-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage

# start Enterprise Edition
- name: Upload Yakit(Enterprise) Artifacts Windows
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -177,7 +195,13 @@ jobs:
# Yakit-1.0.3-beta24-win32-x64.exe
name: EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage
path: ./release/EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage

- name: Upload Yakit(Enterprise) Artifacts Linux(arm64)
uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/heads/ci/yakit-ee') }}
with:
# Yakit-1.0.3-beta24-win32-x64.exe
name: EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage
path: ./release/EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage
# start Special Edition
- name: Upload Yakit(Special) Artifacts Windows
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -207,6 +231,13 @@ jobs:
# Yakit-1.0.3-beta24-win32-x64.exe
name: EnpriTraceAgent-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage
path: ./release/EnpriTraceAgent-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage
- name: Upload Yakit(Special) Artifacts Linux(arm64)
uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/heads/ci/yakit-se') }}
with:
# Yakit-1.0.3-beta24-win32-x64.exe
name: EnpriTraceAgent-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage
path: ./release/EnpriTraceAgent-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage

publish_yakit_ee_to_oss:
if: ${{ startsWith(github.ref, 'refs/heads/ci/yakit-ee') && !endsWith(github.ref, '/no-release') }}
Expand Down Expand Up @@ -244,6 +275,10 @@ jobs:
uses: actions/download-artifact@v2
with:
name: EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage
- name: Download Yakit (Linux arm64)
uses: actions/download-artifact@v2
with:
name: EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage
- run: ls
name: Ls Published Artifacts...

Expand All @@ -263,6 +298,7 @@ jobs:
Yakit-${{ steps.extract_version.outputs.version }}-darwin-x64.dmg:/yak/${{ steps.extract_version.outputs.version }}/EnpriTrace-${{ steps.extract_version.outputs.version }}-darwin-x64.dmg
Yakit-${{ steps.extract_version.outputs.version }}-darwin-arm64.dmg:/yak/${{ steps.extract_version.outputs.version }}/EnpriTrace-${{ steps.extract_version.outputs.version }}-darwin-arm64.dmg
Yakit-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage:/yak/${{ steps.extract_version.outputs.version }}/EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-amd64.AppImage
Yakit-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage:/yak/${{ steps.extract_version.outputs.version }}/EnpriTrace-${{ steps.extract_version.outputs.version }}-linux-arm64.AppImage
# special edition
publish_yakit_se_to_oss:
if: ${{ startsWith(github.ref, 'refs/heads/ci/yakit-se') && !endsWith(github.ref, '/no-release') }}
Expand Down Expand Up @@ -349,7 +385,10 @@ jobs:
uses: actions/download-artifact@v2
with:
name: Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage

- name: Download Yakit (Linux arm64)
uses: actions/download-artifact@v2
with:
name: Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-arm64.AppImage
- run: ls
name: Ls Published Artifacts...

Expand Down Expand Up @@ -409,7 +448,16 @@ jobs:
asset_path: ./Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage
asset_name: Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage
asset_content_type: application/octet-stream

- name: Upload Release Asset (Linux-arm64)
uses: actions/upload-release-asset@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-arm64.AppImage
asset_name: Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-arm64.AppImage
asset_content_type: application/octet-stream
- name: Run
run: ls
# - name: Upload yak to oss Latest
Expand Down Expand Up @@ -450,4 +498,5 @@ jobs:
Yakit-${{ steps.fetchtag_release.outputs.value }}-windows-amd64.exe:/yak/${{ steps.fetchtag_release.outputs.value }}/Yakit-${{ steps.fetchtag_release.outputs.value }}-windows-amd64.exe
Yakit-${{ steps.fetchtag_release.outputs.value }}-darwin-x64.dmg:/yak/${{ steps.fetchtag_release.outputs.value }}/Yakit-${{ steps.fetchtag_release.outputs.value }}-darwin-x64.dmg
Yakit-${{ steps.fetchtag_release.outputs.value }}-darwin-arm64.dmg:/yak/${{ steps.fetchtag_release.outputs.value }}/Yakit-${{ steps.fetchtag_release.outputs.value }}-darwin-arm64.dmg
Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage:/yak/${{ steps.fetchtag_release.outputs.value }}/Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage
Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage:/yak/${{ steps.fetchtag_release.outputs.value }}/Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-amd64.AppImage
Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-arm64.AppImage:/yak/${{ steps.fetchtag_release.outputs.value }}/Yakit-${{ steps.fetchtag_release.outputs.value }}-linux-arm64.AppImage
80 changes: 80 additions & 0 deletions buildHooks/before_pack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
module.exports = async function (context) {
const archMap = {
1: 'x64',
3: 'arm64',
};
const arch = archMap[context.arch];

/**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}-${version}-linux-arm64.${ext}';
linuxConfig.extraFiles = [
...linuxExtraFiles,
{
"from": "bins/yak_linux_arm64.zip",
"to": "bins/yak.zip",
},
]
break;
case 'x64':
linuxConfig.artifactName = '${productName}-${version}-linux-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",
},
]
switch (arch) {
case 'arm64':
macConfig.extraFiles = [
...darwinExtraFiles,
{
"from": "bins/yak_darwin_arm64.zip",
"to": "bins/yak.zip",
},
]
break;
case 'x64':
macConfig.extraFiles = [
...darwinExtraFiles,
{
"from": "bins/yak_darwin_amd64.zip",
"to": "bins/yak.zip",
},
]
break;

default:
break;
}
context.packager.config.mac = macConfig
}
};
51 changes: 26 additions & 25 deletions electron-builder.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
appId: 'io.yaklang.yakit'
productName: 'Yakit'
appId: "io.yaklang.yakit"
productName: "Yakit"
copyright: Copyright © 2024 yaklang.io



extraFiles:
- from: "bins/scripts/auto-install-cert.zip"
to: "bins/scripts/auto-install-cert.zip"
Expand All @@ -27,6 +25,8 @@ extraFiles:
- "!*.db"
- from: "LICENSE.md"
to: "LICENSE.md"
- from: "report/template.zip"
to: "report/template.zip"

directories:
buildResources: resources
Expand All @@ -42,13 +42,13 @@ publish:

mac:
artifactName: ${productName}-${version}-darwin-${arch}.${ext}
extraFiles:
- from: "bins/flag.darwin.txt"
to: "bins/flag.darwin.txt"
- from: "bins/yak_darwin_amd64.zip"
to: "bins/yak.zip"
- from: "report/template.zip"
to: "report/template.zip"
# extraFiles:
# - from: "bins/flag.darwin.txt"
# to: "bins/flag.darwin.txt"
# - from: bins/yak_darwin_${arch}.zip
# to: "bins/yak.zip"
# - from: "report/template.zip"
# to: "report/template.zip"
target:
- target: dmg
arch:
Expand All @@ -57,18 +57,19 @@ mac:
icon: "app/assets/yakitlogo.icns"

linux:
artifactName: ${productName}-${version}-linux-amd64.${ext}
extraFiles:
- from: "bins/flag.linux.txt"
to: "bins/flag.linux.txt"
- from: "bins/yak_linux_amd64.zip"
to: "bins/yak.zip"
- from: "report/template.zip"
to: "report/template.zip"
# artifactName: ${productName}-${version}-linux-${arch}.${ext}
# extraFiles:
# - from: "bins/flag.linux.txt"
# to: "bins/flag.linux.txt"
# - from: bins/yak_linux_${arch}.zip
# to: "bins/yak.zip"
# - from: "report/template.zip"
# to: "report/template.zip"
target:
- target: AppImage
arch:
- x64
- arm64
icon: "app/assets/yakitlogo.icns"

win:
Expand All @@ -78,8 +79,6 @@ win:
to: "bins/flag.windows.txt"
- from: "bins/yak_windows_amd64.zip"
to: "bins/yak.zip"
- from: "report/template.zip"
to: "report/template.zip"
# requestedExecutionLevel: requireAdministrator
target:
- target: nsis
Expand All @@ -89,18 +88,20 @@ win:


nsis:
oneClick: false
oneClick: false
perMachine: false
deleteAppDataOnUninstall: true
allowToChangeInstallationDirectory: true
installerIcon: app/assets/yakitlogo.ico
uninstallerIcon: app/assets/yakitlogo.ico
allowToChangeInstallationDirectory: true
installerIcon: app/assets/yakitlogo.ico
uninstallerIcon: app/assets/yakitlogo.ico
unicode: true
include: build/yakit_build.nsh
license: LICENSE.md
warningsAsErrors: false
createDesktopShortcut: false
createStartMenuShortcut: true

beforePack: "buildHooks/before_pack.js"
#publish:
# - provider: generic
# url: https://update.electron-builder.com
Expand Down

0 comments on commit 4cca20a

Please sign in to comment.