Add cross-platform GitHub Actions build & package workflow#1
Add cross-platform GitHub Actions build & package workflow#1Lexian-droid merged 3 commits intomasterfrom
Conversation
…age scripts Co-authored-by: Lexian-droid <83799577+Lexian-droid@users.noreply.github.com>
|
@copilot It appears that the two windows related workflows have failed: Error: No files were found with the provided path: WeAnimate-/. No artifacts will be uploaded. Both workflows reported the same reason |
…-packager scripts Co-authored-by: Lexian-droid <83799577+Lexian-droid@users.noreply.github.com>
Root cause found from the logs: On Windows (PowerShell), single quotes are not string delimiters — they become literal characters in the argument. So Fixed in 68c66ae by removing the unnecessary single quotes from the app name in all three |
package:win,package:mac,package:linuxscripts topackage.json; updatepackageto delegate topackage:win.github/workflows/build.ymlwith matrix build for ubuntu-latest, windows-latest, macos-latest (Node 20.x, no-audit npm install, platform-specific packaging, artifact upload,contents: readpermissions)README.mdwith artifact download instructions and local build documentationelectron-packagerscripts (on Windows/PowerShell, single quotes are literal characters, causing the output folder to be named'WeAnimate'-win32-x64instead ofWeAnimate-win32-x64)Original prompt
Add a GitHub Actions workflow to GoExport/WeAnimate that builds and packages the Electron app on all three platforms (Windows, macOS, Linux) using the existing npm scripts.
Context
vite build && node scripts/build.mjsnpx electron-packager dist 'WeAnimate' --icon=dist/favicon.ico --overwritedist/folder containing the bundled Electron main (dist/main.js), static resources, and a minimaldist/package.jsonplus production dependencies installed into dist.Requirements
Create a workflow file at
.github/workflows/build.yml(or similar) that:ubuntu-latest,windows-latest,macos-latest.>=16; prefer 20.x unless repo constraints require otherwise).npm ci(ornpm installifpackage-lock.jsonis absent) and thennpm run build.npm run package.Handle platform icon differences:
--icon=dist/favicon.ico..icnsicon on macOS if required by electron-packager; ensure packaging succeeds on macOS.npm run packagebehavior; if changes are needed, prefer adding new scripts (e.g.,package:win,package:mac,package:linux) and have the workflow call them.Ensure artifacts include platform outputs:
.exe.appbundle folderAdd minimal documentation in README or comments in the workflow describing how to download artifacts.
Acceptance criteria
Notes
npm installand consider adding--no-audit --no-fundfor CI speed.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: How do I build this project to electron executable? I want to do it for both Windows and Linux.
Assistant: This repo is already set up to produce a packaged Electron app via
electron-packager, and it looks like the “Electron main process” entry is built intodist/main.jsbyscripts/build.mjs(it bundlessrc/main/index.tsintodist/main.js, then writes a minimaldist/package.jsonwhose"main"is"main.js"and installs only runtime deps intodist/).I can’t currently fetch
src/main/index.ts/vite.config.mjsdue to a GitHub read-tool limitation in this session, but you don’t need them to build a runnable executable—the npm scripts already define the pipeline.Prereqs
package.jsonengines)Build & package (same flow on Windows and Linux)
From the repo root:
dist/):What you should get:
WeAnimate-<platform>-<arch>/created byelectron-packager(by default it lands in the project root unless configured otherwise).WeAnimate.exeWeAnimate(binary)Building for Windows and Linux
Option A (recommended): build on each OS
Electron packaging is simplest when you run the commands on the target OS:
On Windows (PowerShell/CMD):
On Linux:
Option B: cross-build from one OS (often painful)
electron-packagercan target other platforms, but cross-building frequently breaks due to native tooling/icon formats. Your currentpackagescript is:To cross-target you’d typically add flags like
--platform=win32 --arch=x64or--platform=linux --arch=x64, but:If you tell me what machine you’re building from (Windows or Linux) and what CPU arch you need (x64 vs arm64), I can s...
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.