Build Application #1
This file contains hidden or 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
name: Build Application | |
on: | |
workflow_dispatch: | |
inputs: | |
platform: | |
description: '选择构建平台' | |
required: true | |
default: 'all' | |
type: choice | |
options: | |
- all | |
- windows | |
- linux | |
jobs: | |
build-windows: | |
if: github.event.inputs.platform == 'all' || contains(github.event.inputs.platform, 'windows') | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
arch: [x64, arm64] | |
include: | |
- arch: x64 | |
platform: win-x64 | |
- arch: arm64 | |
platform: win-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install dependencies | |
run: npm install | |
env: | |
npm_config_platform: win32 | |
npm_config_arch: ${{ matrix.arch }} | |
- name: Install Node Runtime | |
run: npm run installRuntime:win:${{ matrix.arch }} | |
- name: Install Sharp | |
run: npm install sharp --build-from-source | |
- name: Build Windows | |
run: npm run build:win:${{ matrix.arch }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deepchat-${{ matrix.platform }} | |
path: | | |
dist/*.exe | |
dist/*.msi | |
dist/*.zip | |
!dist/win-unpacked | |
build-linux: | |
if: github.event.inputs.platform == 'all' || contains(github.event.inputs.platform, 'linux') | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
arch: [x64] | |
include: | |
- arch: x64 | |
platform: linux-x64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install dependencies | |
run: npm install | |
env: | |
npm_config_platform: linux | |
npm_config_arch: ${{ matrix.arch }} | |
- name: Install Node Runtime | |
run: npm run installRuntime:linux:${{ matrix.arch }} | |
- name: Install Sharp | |
run: npm install --cpu=wasm32 sharp | |
- name: Build Linux | |
run: npm run build:linux:${{ matrix.arch }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deepchat-${{ matrix.platform }} | |
path: | | |
dist/*.AppImage | |
dist/*.deb | |
dist/*.rpm | |
dist/*.tar.gz | |
!dist/linux-unpacked |