Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add windows-arm64 build action #193

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/win-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Electron App on Windows

# 触发条件:推送、Pull Request 或手动触发时执行
on:
[workflow_dispatch]

jobs:
build-on-windows:
runs-on: windows-latest # 使用 Windows runner
steps:
# Step 1: 检出代码
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

# Step 2: 设置 Node.js 环境
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '16.x' # 根据需求设置为 '14.x' 或 '20.x'

# Step 3: 使用 Chocolatey 安装依赖(Python, vcredist-all, make)
- name: Install Dependencies via Chocolatey
run: |
choco install python310 make zip -y
# Step 4: 安装项目依赖
- name: Install Project Dependencies
run: |
make i
# Step 5: 构建应用
- name: Build Application
run: make build

- name: Build
run: ./node_modules/.bin/gulp win-arm64

- name: Package build directory
run: |
zip -r ./windows-arm64.zip ./build/

- name: release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
./windows-arm64.zip
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}


29 changes: 29 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,32 @@ gulp.task("linux32zip", done => {
archive.directory(inputDir, false);
archive.finalize().then(done);
});

gulp.task("win-arm64", done => {
console.log(`--package ${NAME}-win-arm64`);

// 确定目标目录
const targetDir = path.resolve(TARGET, `./${NAME}-win-arm64`);

// 删除目标目录(如果存在)
plugins.run(`rm -rf ${targetDir}`).exec(() => {
let options = Object.assign({}, packagerOptions);
options.platform = "win32";
options.arch = "arm64";
options.icon = `${BRAND}/qiniu.png`;

// 使用 electron-packager 进行打包
packager(options).then((paths) => {
// 打印打包生成的路径
console.log("打包完成,生成的文件路径如下:");
paths.forEach((path) => {
console.log(path);
});

console.log("--done");
done();
}, (errs) => {
console.error("打包时出错:", errs);
});
});
});