📦 Chore(custom): add arm64 build test

This commit is contained in:
Kuingsmile
2025-08-13 10:25:28 +08:00
parent b31428a67c
commit 6785e1d0ad
3 changed files with 51 additions and 20 deletions

View File

@@ -6,9 +6,6 @@ name: Auto Build
# Workflow's trigger # Workflow's trigger
on: on:
workflow_dispatch: workflow_dispatch:
push:
branches:
- release
env: env:
ELECTRON_OUTPUT_PATH: ./dist_electron ELECTRON_OUTPUT_PATH: ./dist_electron
@@ -17,7 +14,7 @@ env:
jobs: jobs:
release: release:
name: build and release electron app name: Build
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -33,7 +30,7 @@ jobs:
git config --global core.autocrlf false git config --global core.autocrlf false
- name: Check out git repository - name: Check out git repository
uses: actions/checkout@v2 uses: actions/checkout@v4
# step2: sign # step2: sign
- name: Install the Apple certificates - name: Install the Apple certificates

View File

@@ -21,7 +21,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-13, windows-latest] os: [ubuntu-latest, macos-13, windows-latest, windows-11-arm]
steps: steps:
- name: Set up git config - name: Set up git config
@@ -49,11 +49,17 @@ jobs:
yarn install yarn install
npm rebuild --platform=darwin --arch=arm64 sharp npm rebuild --platform=darwin --arch=arm64 sharp
- name: Install dependencies (Windows) - name: Install dependencies (Windows x64)
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: | run: |
yarn config set ignore-engines true yarn config set ignore-engines true
yarn install yarn install
- name: Install dependencies (Windows ARM64)
if: matrix.os == 'windows-11-arm'
run: |
yarn config set ignore-engines true
yarn install
- name: Install dependencies (Linux) - name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
@@ -61,8 +67,32 @@ jobs:
yarn config set ignore-engines true yarn config set ignore-engines true
yarn install yarn install
- name: Build application (Windows) - name: Modify electron-builder.json for Windows x64
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: |
# Remove arm64 from the arch array, keep only x64
$config = Get-Content electron-builder.json | ConvertFrom-Json
$config.win.target[0].arch = @("x64")
$config | ConvertTo-Json -Depth 10 | Set-Content electron-builder.json
- name: Modify electron-builder.json for Windows ARM64
if: matrix.os == 'windows-11-arm'
run: |
# Remove x64 from the arch array, keep only arm64
$config = Get-Content electron-builder.json | ConvertFrom-Json
$config.win.target[0].arch = @("arm64")
$config | ConvertTo-Json -Depth 10 | Set-Content electron-builder.json
- name: Build application (Windows x64)
if: matrix.os == 'windows-latest'
run: yarn build:win
env:
ELECTRON_SKIP_NOTARIZATION: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Build application (Windows ARM64)
if: matrix.os == 'windows-11-arm'
run: yarn build:win run: yarn build:win
env: env:
ELECTRON_SKIP_NOTARIZATION: true ELECTRON_SKIP_NOTARIZATION: true
@@ -85,14 +115,23 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }} GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Upload Windows executables with original names - name: Upload Windows x64 executables
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: windows-executables name: windows-x64-executables
path: |
dist_electron/PicList-Setup-*.exe
retention-days: 30
if-no-files-found: error
- name: Upload Windows ARM64 executables
if: matrix.os == 'windows-11-arm'
uses: actions/upload-artifact@v4
with:
name: windows-arm64-executables
path: | path: |
dist_electron/PicList-Setup-*.exe dist_electron/PicList-Setup-*.exe
dist_electron/*.exe.blockmap
retention-days: 30 retention-days: 30
if-no-files-found: error if-no-files-found: error
@@ -103,9 +142,6 @@ jobs:
name: macos-packages name: macos-packages
path: | path: |
dist_electron/PicList-*.dmg dist_electron/PicList-*.dmg
dist_electron/PicList-*.zip
dist_electron/*.dmg.blockmap
dist_electron/*.zip.blockmap
retention-days: 30 retention-days: 30
if-no-files-found: error if-no-files-found: error
@@ -116,9 +152,6 @@ jobs:
name: linux-packages name: linux-packages
path: | path: |
dist_electron/PicList-*.AppImage dist_electron/PicList-*.AppImage
dist_electron/PicList-*.snap dist_electron/*.snap
dist_electron/PicList-*.deb
dist_electron/PicList-*.rpm
dist_electron/PicList-*.tar.gz
retention-days: 30 retention-days: 30
if-no-files-found: ignore if-no-files-found: ignore

View File

@@ -6,6 +6,7 @@
"output": "dist_electron", "output": "dist_electron",
"buildResources": "build" "buildResources": "build"
}, },
"asarUnpack": ["**/node_modules/sharp/**", "**/node_modules/ssh2-no-cpu-features/**", "**/node_modules/@img/**"],
"files": ["out/**/*", "dist/**/*", "resources/**/*", "package.json"], "files": ["out/**/*", "dist/**/*", "resources/**/*", "package.json"],
"extraResources": [ "extraResources": [
{ {
@@ -66,7 +67,7 @@
"target": [ "target": [
{ {
"target": "nsis", "target": "nsis",
"arch": ["x64", "ia32"] "arch": ["x64", "arm64"]
} }
] ]
}, },
@@ -78,7 +79,7 @@
}, },
"linux": { "linux": {
"icon": "resources/", "icon": "resources/",
"asarUnpack": ["**/node_modules/sharp/**", "**/node_modules/ssh2-no-cpu-features/**"] "asarUnpack": ["**/node_modules/sharp/**", "**/node_modules/ssh2-no-cpu-features/**", "**/node_modules/@img/**"]
}, },
"snap": { "snap": {
"publish": ["github"] "publish": ["github"]