feat: make electron windows build (#1611)

This commit is contained in:
Horus 2023-03-18 21:43:39 +08:00 committed by GitHub
parent 473076b603
commit 56ce99a5dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 13 deletions

View File

@ -91,7 +91,7 @@ jobs:
path: apps/electron/dist
- name: make build
run: yarn make-macos-arm64
run: yarn make-macos-x64
working-directory: apps/electron
- name: Save x64 artifacts
@ -143,8 +143,46 @@ jobs:
name: affine-darwin-arm64-builds
path: builds
build-windows:
needs: before-make
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install # that's right, yarn
working-directory: apps/electron
- uses: actions/download-artifact@v3
with:
name: before-make-web-static
path: apps/electron/resources/web-static
- uses: actions/download-artifact@v3
with:
name: before-make-electron-dist
path: apps/electron/dist
- name: make build
run: yarn make-windows-x64
working-directory: apps/electron
- name: Save windows artifacts
run: |
mkdir -p builds
mv apps/electron/out/make/zip/win32/x64/AFFiNE-win32-x64-0.0.0.zip ./builds/affine-windows-x64-${{ github.event.inputs.version }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: affine-darwin-arm64-builds
path: builds
release:
needs: [build-macos-x64, build-macos-arm64]
needs: [build-macos-x64, build-macos-arm64, build-windows]
runs-on: ubuntu-latest
steps:
- name: Download MacOS x64 Artifacts
@ -158,6 +196,11 @@ jobs:
with:
name: affine-darwin-arm64-builds
path: ./
- name: Download Windows Artifacts
uses: actions/download-artifact@v3
with:
name: affine-windows-x64-builds
path: ./
- name: Create Release Draft
uses: softprops/action-gh-release@v1
@ -177,3 +220,4 @@ jobs:
./RELEASES
./*.AppImage
./*.apk
./*.zip

View File

@ -12,5 +12,13 @@ module.exports = {
name: 'AFFiNE',
},
},
{
name: '@electron-forge/maker-zip',
config: {
name: 'affine',
iconUrl: './resources/icons/icon.ico',
setupIcon: './resources/icons/icon.ico',
},
},
],
};

View File

@ -3,12 +3,17 @@
"productName": "AFFiNE",
"private": true,
"version": "0.0.0",
"author": "affine",
"description": "AFFiNE App",
"homepage": "https://github.com/toeverything/AFFiNE",
"scripts": {
"dev": "node scripts/dev.mjs",
"prod": "NODE_ENV=production node scripts/dev.mjs",
"dev": "cross-env NODE_ENV=development node scripts/dev.mjs",
"prod": "cross-env NODE_ENV=production node scripts/dev.mjs",
"before-make": "zx scripts/before-make.mjs",
"make": "electron-forge make",
"make-macos-arm64": "electron-forge make --platform=darwin --arch=arm64",
"make-macos-x64": "electron-forge make --platform=darwin --arch=x64",
"make-windows-x64": "electron-forge make --platform=win32 --arch=x64",
"postinstall": "ELECTRON_RUN_AS_NODE=1 electron scripts/update-electron-vendors.mjs"
},
"config": {
@ -26,11 +31,12 @@
"@electron-forge/shared-types": "^6.0.5",
"@electron/rebuild": "^3.2.10",
"dts-for-context-bridge": "^0.7.1",
"electron": "^23.1.3",
"electron": "23.1.4",
"esbuild": "^0.17.8",
"zx": "^7.2.0"
},
"dependencies": {
"cross-env": "7.0.3",
"electron-window-state": "^5.0.3"
},
"packageManager": "yarn@3.4.1"

View File

@ -1,8 +1,8 @@
import fs from 'node:fs';
import path from 'node:path';
const __dirname = new URL('.', import.meta.url).pathname;
import * as url from 'node:url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
// const __dirname = new URL('.', import.meta.url).pathname;
const { node } = JSON.parse(
fs.readFileSync(
path.join(__dirname, '../electron-vendors.autogen.json'),

View File

@ -18,8 +18,9 @@ __metadata:
"@electron-forge/maker-zip": ^6.0.5
"@electron-forge/shared-types": ^6.0.5
"@electron/rebuild": ^3.2.10
cross-env: 7.0.3
dts-for-context-bridge: ^0.7.1
electron: ^23.1.3
electron: 23.1.4
electron-window-state: ^5.0.3
esbuild: ^0.17.8
zx: ^7.2.0
@ -1280,6 +1281,18 @@ __metadata:
languageName: node
linkType: hard
"cross-env@npm:7.0.3":
version: 7.0.3
resolution: "cross-env@npm:7.0.3"
dependencies:
cross-spawn: ^7.0.1
bin:
cross-env: src/bin/cross-env.js
cross-env-shell: src/bin/cross-env-shell.js
checksum: 26f2f3ea2ab32617f57effb70d329c2070d2f5630adc800985d8b30b56e8bf7f5f439dd3a0358b79cee6f930afc23cf8e23515f17ccfb30092c6b62c6b630a79
languageName: node
linkType: hard
"cross-spawn-windows-exe@npm:^1.1.0, cross-spawn-windows-exe@npm:^1.2.0":
version: 1.2.0
resolution: "cross-spawn-windows-exe@npm:1.2.0"
@ -1585,16 +1598,16 @@ __metadata:
languageName: node
linkType: hard
"electron@npm:^23.1.3":
version: 23.1.3
resolution: "electron@npm:23.1.3"
"electron@npm:23.1.4":
version: 23.1.4
resolution: "electron@npm:23.1.4"
dependencies:
"@electron/get": ^2.0.0
"@types/node": ^16.11.26
extract-zip: ^2.0.1
bin:
electron: cli.js
checksum: 091a7acd2379c8b8e9df76244ca2e0f5f2aa9e4a94da9c08f56fdc4762f27f5fd7f3505a027c00601f64c5beeb27e5c707a2061ff37654ded55e21cedeb0b926
checksum: 42e167d5ae4e60b9a2bab191321645cb76b901d3c88dc7ae1551ecad2946aa4ebef9e49c347ca3db76032d84802d878a64a1123111579a270e3b8406c5a18b16
languageName: node
linkType: hard

View File

@ -2,5 +2,6 @@ packages:
# apps folder for multiple platform clients
- 'apps/*'
- '!apps/electron'
- '!apps/desktop'
# all packages in direct subdirs of packages/
- 'packages/*'