Skip to content

Multi-Platform Build Develop #2

Multi-Platform Build Develop

Multi-Platform Build Develop #2

name: Multi-Platform Build Develop
on:
workflow_dispatch:
inputs:
platform:
description: "Choose a platform"
required: true
type: choice
options:
- windows
- darwin
- linux
- mwl
legacy:
description: "Compatible with older versions of the system"
required: false
type: boolean
default: false
version:
description: "Select version type"
required: true
type: choice
default: ce
options:
- ce
- ee
- se
engine:
description: "Is there a built-in engine"
required: false
type: boolean
default: false
devTool:
description: "Do you want to display developer tools"
required: false
type: boolean
default: false
engineVersion:
description: "Specify engine version"
required: false
type: string
jobs:
build_yakit:
runs-on: macos-13
env:
CI: ""
NODE_OPTIONS: --max_old_space_size=4096
steps:
- name: Display incoming configuration parameters
run: echo ${{ inputs.platform }} ${{ inputs.legacy }} ${{ inputs.version }} ${{ inputs.engine }} ${{ inputs.devTool }} ${{ inputs.engineVersion }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.18.2
# 缓存 yarn 依赖包 ↓↓↓
cache: "yarn"
cache-dependency-path: |
yarn.lock
app/renderer/src/main/yarn.lock
- run: echo ${{ github.ref }}
- run: cp buildutil/zip /usr/local/bin/zip
- run: chmod +x /usr/local/bin/zip
- run: zip -h
- name: "Download Yak Engine via wget(MacOS)"
if: ${{ inputs.engine && contains(fromJSON('["darwin","mwl"]'), inputs.platform) }}
id: download-darwin-engine
run: wget -O bins/yak_darwin_amd64 https://yaklang.oss-accelerate.aliyuncs.com/yak/${{ inputs.engineVersion || '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)"
if: ${{ inputs.engine && contains(fromJSON('["darwin","mwl"]'), inputs.platform) }}
id: download-darwin-engine-arm64
run: wget -O bins/yak_darwin_arm64 https://yaklang.oss-accelerate.aliyuncs.com/yak/${{ inputs.engineVersion || '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)"
if: ${{ inputs.engine && contains(fromJSON('["linux","mwl"]'), inputs.platform) }}
id: download-linux-engine
run: wget -O bins/yak_linux_amd64 https://yaklang.oss-accelerate.aliyuncs.com/yak/${{ inputs.engineVersion || '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)"
if: ${{ inputs.engine && contains(fromJSON('["linux","mwl"]'), inputs.platform) }}
id: download-linux-engine-arm64
run: wget -O bins/yak_linux_arm64 https://yaklang.oss-accelerate.aliyuncs.com/yak/${{ inputs.engineVersion || '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)"
if: ${{ inputs.engine && !inputs.legacy && contains(fromJSON('["windows","mwl"]'), inputs.platform) }}
id: download-windows-engine
run: wget -O bins/yak_windows_amd64.exe https://yaklang.oss-accelerate.aliyuncs.com/yak/${{ inputs.engineVersion || 'latest' }}/yak_windows_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
- name: "Download Yak Legacy Engine via wget(Windows)"
if: ${{ inputs.engine && inputs.legacy && contains(fromJSON('["windows","mwl"]'), inputs.platform) }}
id: download-windows-leagacy-engine
run: wget -O bins/yak_windows_amd64.exe https://yaklang.oss-accelerate.aliyuncs.com/yak/${{ inputs.engineVersion || 'latest' }}/yak_windows_legacy_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
- name: "Fetch Latest EngineVersion"
if: ${{ inputs.engine && !inputs.engineVersion }}
run: wget -O bins/engine-version.txt https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/version.txt
- name: "Fetch Specify EngineVersion"
if: ${{ inputs.engine && inputs.engineVersion }}
run: |
mkdir -p bins
echo "${{ inputs.engineVersion }}" > bins/engine-version.txt
- if: ${{ inputs.engine }}
run: ls ./bins && cat bins/engine-version.txt
- name: Extract Package.json Version
id: extract_version
uses: Saionaro/[email protected]
- 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 ${{ steps.package_version.outputs.value }}
- run: yarn install && yarn install-render
working-directory: ./
name: "Install Dependencies"
- run: yarn add [email protected]
if: ${{ inputs.legacy }}
working-directory: ./
name: "Install Legacy Electron"
- name: "Build CE Render"
if: ${{ inputs.version == 'ce' }}
working-directory: ./
run: yarn build${{ inputs.devTool && '-test' || '' }}-render
- name: "Build EE Render"
if: ${{ inputs.version == 'ee' }}
working-directory: ./
run: yarn build-render${{ inputs.devTool && '-test' || '' }}-enterprise
- name: "Build SE Render"
if: ${{ inputs.version == 'se' }}
working-directory: ./
run: yarn build-render${{ inputs.devTool && '-test' || '' }}-simple-enterprise
- name: Build Yakit (MultiPlatform)
if: ${{ inputs.platform == 'mwl' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
yarn add -D dmg-license
if [ "${{ inputs.version }}" = "ce" ]; then
yarn electron-publish${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn electron-publish-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn electron-publish-se${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: Build Yakit (MAC)
if: ${{ inputs.platform == 'darwin' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
yarn pack-mac${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn pack-mac-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn pack-mac-se${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: Build Yakit (LINUX)
if: ${{ inputs.platform == 'linux' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
yarn pack-linux${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn pack-linux-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn pack-linux-se${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: Build Yakit (WIN)
if: ${{ inputs.platform == 'windows' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
yarn pack-win${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn pack-win-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn pack-win-se${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- 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: Generate software prefix name
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
echo "ENV_Software_Name=Yakit" >> $GITHUB_ENV
elif [ "${{ inputs.version }}" = "ee" ]; then
echo "ENV_Software_Name=EnpriTrace" >> $GITHUB_ENV
elif [ "${{ inputs.version }}" = "se" ]; then
echo "ENV_Software_Name=EnpriTraceAgent" >> $GITHUB_ENV
else
echo "No software version obtained" >&2
exit 1
fi
- name: Show ENV_Software_Name
run: echo "ENV_Software_Name: $ENV_Software_Name"
- name: Upload Yakit(CE) Artifacts Windows
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.platform }}-${{ inputs.version }}-${{env.ENV_Software_Name}}-artifacts
path: |
./release/${{env.ENV_Software_Name}}-${{ steps.package_version.outputs.value }}-*.exe
./release/${{env.ENV_Software_Name}}-${{ steps.package_version.outputs.value }}-*.dmg
./release/${{env.ENV_Software_Name}}-${{ steps.package_version.outputs.value }}-*.AppImage
if-no-files-found: error