Skip to content

Commit

Permalink
fix(electron): release desktop app workflow (#4594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn authored Oct 17, 2023
1 parent 0198799 commit e831f61
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 39 deletions.
8 changes: 8 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ inputs:
description: 'Build plugins'
required: false
default: 'true'
nmHoistingLimits:
description: 'Set nmHoistingLimits in .yarnrc.yml'
required: false

runs:
using: 'composite'
Expand All @@ -46,6 +49,11 @@ runs:
shell: bash
run: yarn config set nmMode hardlinks-local

- name: Set nmHoistingLimits
if: ${{ inputs.nmHoistingLimits }}
shell: bash
run: yarn config set nmHoistingLimits ${{ inputs.nmHoistingLimits }}

- name: yarn install
if: ${{ inputs.package-install == 'true' }}
continue-on-error: true
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/release-desktop-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RELEASE_VERSION: ${{ github.event.inputs.version || steps.get-canary-version.outputs.RELEASE_VERSION }}
SKIP_PLUGIN_BUILD: 'true'

- name: Upload core artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -105,6 +106,11 @@ jobs:
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo
hard-link-nm: false
build-plugins: false
nmHoistingLimits: workspaces
- name: Setup Maker
timeout-minutes: 10
uses: ./.github/actions/setup-maker
Expand All @@ -131,6 +137,10 @@ jobs:

- name: make
run: yarn workspace @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_PLUGIN_BUILD: 1
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1

- name: Save artifacts (mac)
if: ${{ matrix.spec.platform == 'darwin' }}
Expand Down Expand Up @@ -173,6 +183,11 @@ jobs:
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo
hard-link-nm: false
build-plugins: false
nmHoistingLimits: workspaces
- name: Setup Maker
timeout-minutes: 10
uses: ./.github/actions/setup-maker
Expand All @@ -195,6 +210,10 @@ jobs:

- name: package
run: yarn workspace @affine/electron package --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_PLUGIN_BUILD: 1
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1

- name: get all files to be signed
id: get_files_to_be_signed
Expand Down
18 changes: 10 additions & 8 deletions apps/electron/forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,17 @@ module.exports = {
packageJson.productName = productName;
},
prePackage: async () => {
await rm(path.join(__dirname, 'node_modules'), {
recursive: true,
force: true,
});
if (!process.env.HOIST_NODE_MODULES) {
await rm(path.join(__dirname, 'node_modules'), {
recursive: true,
force: true,
});

await symlink(
path.join(__dirname, '..', '..', 'node_modules'),
path.join(__dirname, 'node_modules')
);
await symlink(
path.join(__dirname, '..', '..', 'node_modules'),
path.join(__dirname, 'node_modules')
);
}
},
generateAssets: async (_, platform, arch) => {
if (process.env.SKIP_GENERATE_ASSETS) {
Expand Down
2 changes: 1 addition & 1 deletion apps/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@types/uuid": "^9.0.5",
"builder-util-runtime": "^9.2.1",
"cross-env": "7.0.3",
"electron": "^26.4.0",
"electron": "^27.0.0",
"electron-log": "^5.0.0-rc.1",
"electron-squirrel-startup": "1.0.0",
"electron-window-state": "^5.0.3",
Expand Down
5 changes: 4 additions & 1 deletion apps/electron/scripts/generate-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ $.env.DISTRIBUTION = 'desktop';

cd(repoRootDir);

if (!process.env.SKIP_PLUGIN_BUILD) {
await $`yarn -T run build:plugins`;
}

// step 1: build web (nextjs) dist
if (!process.env.SKIP_WEB_BUILD) {
await $`yarn -T run build:plugins`;
await $`yarn nx build @affine/core`;

await $`yarn workspace @affine/electron build`;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"@vanilla-extract/webpack-plugin": "^2.3.1",
"@vitejs/plugin-react-swc": "^3.4.0",
"@vitest/coverage-istanbul": "0.34.6",
"@vitest/ui": "0.34.6",
"@vitest/ui": "0.34.7",
"electron": "^27.0.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-i": "^2.28.1",
Expand Down
1 change: 1 addition & 0 deletions packages/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"module": "./src/index.ts",
"devDependencies": {
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "0.34.6",
Expand Down
1 change: 1 addition & 0 deletions packages/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
},
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@testing-library/react": "^14.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@vitejs/plugin-vue": "^4.4.0",
"rollup": "^3.29.4",
"rollup-plugin-swc3": "^0.10.2",
"ts-node": "^10.9.1"
"ts-node": "^10.9.1",
"vue": "^3.3.4"
}
}
1 change: 1 addition & 0 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dependencies": {
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"jotai": "^2.4.3",
Expand Down
28 changes: 14 additions & 14 deletions packages/storage/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/* auto-generated by NAPI-RS */
/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */

export interface Blob {
contentType: string;
lastModified: string;
size: number;
data: Buffer;
}
/**
* Merge updates in form like `Y.applyUpdate(doc, update)` way and return the
* result binary.
*/
export function mergeUpdatesInApplyWay(updates: Array<Buffer>): Buffer;
export class Storage {
/** Create a storage instance and establish connection to persist store. */
static connect(
Expand All @@ -18,16 +31,3 @@ export class Storage {
/** Workspace size taken by blobs. */
blobsSize(workspaces: Array<string>): Promise<number>;
}

export interface Blob {
contentType: string;
lastModified: string;
size: number;
data: Buffer;
}

/**
* Merge updates in form like `Y.applyUpdate(doc, update)` way and return the
* result binary.
*/
export function mergeUpdatesInApplyWay(updates: Array<Buffer>): Buffer;
3 changes: 2 additions & 1 deletion packages/y-indexeddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"vite": "^4.4.11",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6",
"y-indexeddb": "^9.0.11"
"y-indexeddb": "^9.0.11",
"yjs": "^13.6.8"
},
"peerDependencies": {
"yjs": "^13"
Expand Down
3 changes: 2 additions & 1 deletion packages/y-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"vite": "^4.4.11",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6"
"vitest": "0.34.6",
"yjs": "^13.6.8"
},
"peerDependencies": {
"yjs": "^13"
Expand Down
40 changes: 29 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ __metadata:
async-call-rpc: ^6.3.1
builder-util-runtime: ^9.2.1
cross-env: 7.0.3
electron: ^26.4.0
electron: ^27.0.0
electron-log: ^5.0.0-rc.1
electron-squirrel-startup: 1.0.0
electron-updater: ^6.1.5
Expand Down Expand Up @@ -447,6 +447,7 @@ __metadata:
resolution: "@affine/env@workspace:packages/env"
dependencies:
"@blocksuite/global": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/store": 0.0.0-20230926212737-6d4b1569-nightly
lit: ^2.8.0
react: 18.2.0
react-dom: 18.2.0
Expand Down Expand Up @@ -547,7 +548,8 @@ __metadata:
"@vanilla-extract/webpack-plugin": ^2.3.1
"@vitejs/plugin-react-swc": ^3.4.0
"@vitest/coverage-istanbul": 0.34.6
"@vitest/ui": 0.34.6
"@vitest/ui": 0.34.7
electron: ^27.0.0
eslint: ^8.51.0
eslint-config-prettier: ^9.0.0
eslint-plugin-i: ^2.28.1
Expand Down Expand Up @@ -630,6 +632,7 @@ __metadata:
rollup: ^3.29.4
rollup-plugin-swc3: ^0.10.2
ts-node: ^10.9.1
vue: ^3.3.4
bin:
af: ./src/af.mjs
languageName: unknown
Expand All @@ -641,6 +644,7 @@ __metadata:
dependencies:
"@blocksuite/block-std": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/blocks": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/editor": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/global": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/store": 0.0.0-20230926212737-6d4b1569-nightly
jotai: ^2.4.3
Expand Down Expand Up @@ -12410,6 +12414,7 @@ __metadata:
dependencies:
"@affine-test/fixtures": "workspace:*"
"@affine/sdk": "workspace:*"
"@affine/templates": "workspace:*"
"@blocksuite/blocks": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/editor": 0.0.0-20230926212737-6d4b1569-nightly
"@blocksuite/global": 0.0.0-20230926212737-6d4b1569-nightly
Expand Down Expand Up @@ -12475,6 +12480,7 @@ __metadata:
vitest: 0.34.6
y-indexeddb: ^9.0.11
y-provider: "workspace:*"
yjs: ^13.6.8
peerDependencies:
yjs: ^13
languageName: unknown
Expand Down Expand Up @@ -14024,11 +14030,11 @@ __metadata:
languageName: node
linkType: hard

"@vitest/ui@npm:0.34.6":
version: 0.34.6
resolution: "@vitest/ui@npm:0.34.6"
"@vitest/ui@npm:0.34.7":
version: 0.34.7
resolution: "@vitest/ui@npm:0.34.7"
dependencies:
"@vitest/utils": 0.34.6
"@vitest/utils": 0.34.7
fast-glob: ^3.3.0
fflate: ^0.8.0
flatted: ^3.2.7
Expand All @@ -14037,7 +14043,7 @@ __metadata:
sirv: ^2.0.3
peerDependencies:
vitest: ">=0.30.1 <1"
checksum: aaea587823d38bf5bb1961bbfdddacd42bbcedd7a6f771d8e26f5f597267655a19527434099b11013d00100ddb25a9550d55d1a275c08763dc67407ac7d3baa1
checksum: 6d1c73ee3bb303645c62bdb4ffb87063631e1771c2dbee0a28537678d09ffc97fa9669e2de6d1cd7e469f2b48dfde88f46fb9686ee82591c24050b6723aa9758
languageName: node
linkType: hard

Expand All @@ -14052,6 +14058,17 @@ __metadata:
languageName: node
linkType: hard

"@vitest/utils@npm:0.34.7":
version: 0.34.7
resolution: "@vitest/utils@npm:0.34.7"
dependencies:
diff-sequences: ^29.4.3
loupe: ^2.3.6
pretty-format: ^29.5.0
checksum: d98b8809ada19c207ace43c88d452685adde6966b00e223ac2308b2ea7d0694bdd4d6ff9518ea505e2b5bd4d1b51f44bae430e22fa83ca32c77ad28b61209bc4
languageName: node
linkType: hard

"@volar/language-core@npm:1.10.4, @volar/language-core@npm:~1.10.4":
version: 1.10.4
resolution: "@volar/language-core@npm:1.10.4"
Expand Down Expand Up @@ -18853,16 +18870,16 @@ __metadata:
languageName: node
linkType: soft

"electron@npm:^26.4.0":
version: 26.4.0
resolution: "electron@npm:26.4.0"
"electron@npm:^27.0.0":
version: 27.0.0
resolution: "electron@npm:27.0.0"
dependencies:
"@electron/get": ^2.0.0
"@types/node": ^18.11.18
extract-zip: ^2.0.1
bin:
electron: cli.js
checksum: eb68e980220dee407af33e5662e53dcf9c40f2c29ff2beac76e227368377979b6d649a529b49503227b59cdb8986dd348588338710059ffa93509aa50027bbee
checksum: 4a84cb894d5f626fe7a2b5171693e903ce82a7673aabc419e5d3d0d2f9cc8441e5088524ecd86a046beab4ba7dd13820b7a94c361c3e7bc2f0959d1a1a860df5
languageName: node
linkType: hard

Expand Down Expand Up @@ -34485,6 +34502,7 @@ __metadata:
vite: ^4.4.11
vite-plugin-dts: 3.6.0
vitest: 0.34.6
yjs: ^13.6.8
peerDependencies:
yjs: ^13
languageName: unknown
Expand Down

0 comments on commit e831f61

Please sign in to comment.