fix(electron): check bundle (#3527)
This commit is contained in:
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -431,12 +431,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Make bundle
|
- name: Make bundle
|
||||||
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
|
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
|
||||||
|
env:
|
||||||
|
SKIP_BUNDLE: true
|
||||||
run: yarn workspace @affine/electron make --platform=darwin --arch=arm64
|
run: yarn workspace @affine/electron make --platform=darwin --arch=arm64
|
||||||
|
|
||||||
- name: Bundle output check
|
- name: Bundle output check
|
||||||
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
|
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
|
||||||
run: |
|
run: |
|
||||||
./scripts/unzip-macos-arm64.sh
|
|
||||||
yarn ts-node-esm ./scripts/macos-arm64-output-check.mts
|
yarn ts-node-esm ./scripts/macos-arm64-output-check.mts
|
||||||
working-directory: apps/electron
|
working-directory: apps/electron
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,59 @@ const arch =
|
|||||||
|
|
||||||
const windowsIconUrl = `https://cdn.affine.pro/app-icons/icon_${buildType}.ico`;
|
const windowsIconUrl = `https://cdn.affine.pro/app-icons/icon_${buildType}.ico`;
|
||||||
|
|
||||||
|
const makers = [
|
||||||
|
!process.env.SKIP_BUNDLE && {
|
||||||
|
name: '@affine/maker-dmg',
|
||||||
|
config: {
|
||||||
|
format: 'ULFO',
|
||||||
|
icon: icnsPath,
|
||||||
|
name: 'AFFiNE',
|
||||||
|
'icon-size': 128,
|
||||||
|
background: path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'./resources/icons/dmg-background.png'
|
||||||
|
),
|
||||||
|
file: path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'out',
|
||||||
|
buildType,
|
||||||
|
`${productName}-darwin-${arch}`,
|
||||||
|
`${productName}.app`
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '@electron-forge/maker-zip',
|
||||||
|
config: {
|
||||||
|
name: 'affine',
|
||||||
|
iconUrl: icoPath,
|
||||||
|
setupIcon: icoPath,
|
||||||
|
platforms: ['darwin', 'linux', 'win32'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
!process.env.SKIP_BUNDLE && {
|
||||||
|
name: '@electron-forge/maker-squirrel',
|
||||||
|
config: {
|
||||||
|
name: 'AFFiNE',
|
||||||
|
setupIcon: icoPath,
|
||||||
|
iconUrl: windowsIconUrl,
|
||||||
|
loadingGif: './resources/icons/affine_installing.gif',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
!process.env.SKIP_BUNDLE && {
|
||||||
|
name: '@reforged/maker-appimage',
|
||||||
|
config: {
|
||||||
|
name: 'AFFiNE',
|
||||||
|
iconUrl: icoPath,
|
||||||
|
setupIcon: icoPath,
|
||||||
|
platforms: ['linux'],
|
||||||
|
options: {
|
||||||
|
bin: productName,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
].filter(Boolean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import('@electron-forge/shared-types').ForgeConfig}
|
* @type {import('@electron-forge/shared-types').ForgeConfig}
|
||||||
*/
|
*/
|
||||||
@@ -57,58 +110,7 @@ module.exports = {
|
|||||||
// We need the following line for updater
|
// We need the following line for updater
|
||||||
extraResource: ['./resources/app-update.yml'],
|
extraResource: ['./resources/app-update.yml'],
|
||||||
},
|
},
|
||||||
makers: [
|
makers,
|
||||||
{
|
|
||||||
name: '@affine/maker-dmg',
|
|
||||||
config: {
|
|
||||||
format: 'ULFO',
|
|
||||||
icon: icnsPath,
|
|
||||||
name: 'AFFiNE',
|
|
||||||
'icon-size': 128,
|
|
||||||
background: path.resolve(
|
|
||||||
__dirname,
|
|
||||||
'./resources/icons/dmg-background.png'
|
|
||||||
),
|
|
||||||
file: path.resolve(
|
|
||||||
__dirname,
|
|
||||||
'out',
|
|
||||||
buildType,
|
|
||||||
`${productName}-darwin-${arch}`,
|
|
||||||
`${productName}.app`
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '@electron-forge/maker-zip',
|
|
||||||
config: {
|
|
||||||
name: 'affine',
|
|
||||||
iconUrl: icoPath,
|
|
||||||
setupIcon: icoPath,
|
|
||||||
platforms: ['darwin', 'linux', 'win32'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '@electron-forge/maker-squirrel',
|
|
||||||
config: {
|
|
||||||
name: 'AFFiNE',
|
|
||||||
setupIcon: icoPath,
|
|
||||||
iconUrl: windowsIconUrl,
|
|
||||||
loadingGif: './resources/icons/affine_installing.gif',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '@reforged/maker-appimage',
|
|
||||||
config: {
|
|
||||||
name: 'AFFiNE',
|
|
||||||
iconUrl: icoPath,
|
|
||||||
setupIcon: icoPath,
|
|
||||||
platforms: ['linux'],
|
|
||||||
options: {
|
|
||||||
bin: productName,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
hooks: {
|
hooks: {
|
||||||
readPackageJson: async (_, packageJson) => {
|
readPackageJson: async (_, packageJson) => {
|
||||||
// we want different package name for canary build
|
// we want different package name for canary build
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ import { readdir } from 'node:fs/promises';
|
|||||||
|
|
||||||
const outputRoot = fileURLToPath(
|
const outputRoot = fileURLToPath(
|
||||||
new URL(
|
new URL(
|
||||||
'../zip-out/AFFiNE-canary.app/Contents/Resources/app',
|
'../out/canary/AFFiNE-canary-darwin-arm64/AFFiNE-canary.app/Contents/Resources/app',
|
||||||
import.meta.url
|
import.meta.url
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const outputList = [
|
const outputList = [
|
||||||
[
|
[
|
||||||
'dist',
|
'dist',
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Set the directory
|
|
||||||
dir="./out/canary/make/zip/darwin/arm64"
|
|
||||||
|
|
||||||
# Get the first file
|
|
||||||
file=$(ls -1 $dir | head -n 1)
|
|
||||||
|
|
||||||
# Check if file exists and is a zip file
|
|
||||||
if [ -f "$dir/$file" ] && [ ${file: -4} == ".zip" ]
|
|
||||||
then
|
|
||||||
# Unzip the file
|
|
||||||
unzip "$dir/$file" -d "zip-out"
|
|
||||||
else
|
|
||||||
echo "No zip file found"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user