mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-03 15:16:27 +03:00
feat(electron): support WOA native (#8741)
This commit is contained in:
parent
5605185a00
commit
64674a539f
90
.github/workflows/release-desktop.yml
vendored
90
.github/workflows/release-desktop.yml
vendored
@ -32,7 +32,7 @@ permissions:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_TYPE: ${{ github.event.inputs.build-type }}
|
BUILD_TYPE: ${{ github.event.inputs.build-type }}
|
||||||
DEBUG: napi:*
|
DEBUG: 'affine:*,napi:*'
|
||||||
APP_NAME: affine
|
APP_NAME: affine
|
||||||
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
||||||
|
|
||||||
@ -87,6 +87,7 @@ jobs:
|
|||||||
target: x86_64-unknown-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
runs-on: ${{ matrix.spec.runner }}
|
runs-on: ${{ matrix.spec.runner }}
|
||||||
needs: before-make
|
needs: before-make
|
||||||
|
environment: ${{ github.event.inputs.build-type }}
|
||||||
env:
|
env:
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
@ -163,10 +164,10 @@ jobs:
|
|||||||
if: ${{ matrix.spec.platform == 'linux' }}
|
if: ${{ matrix.spec.platform == 'linux' }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p builds
|
mkdir -p builds
|
||||||
mv packages/frontend/apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.zip
|
mv packages/frontend/apps/electron/out/*/make/zip/linux/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.zip
|
||||||
mv packages/frontend/apps/electron/out/*/make/*.AppImage ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.appimage
|
mv packages/frontend/apps/electron/out/*/make/*.AppImage ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.appimage
|
||||||
mv packages/frontend/apps/electron/out/*/make/deb/x64/*.deb ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.deb
|
mv packages/frontend/apps/electron/out/*/make/deb/${{ matrix.spec.arch }}/*.deb ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.deb
|
||||||
mv packages/frontend/apps/electron/out/*/make/flatpak/*/*.flatpak ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.flatpak
|
mv packages/frontend/apps/electron/out/*/make/flatpak/*/*.flatpak ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.flatpak
|
||||||
|
|
||||||
- uses: actions/attest-build-provenance@v1
|
- uses: actions/attest-build-provenance@v1
|
||||||
if: ${{ matrix.spec.platform == 'darwin' }}
|
if: ${{ matrix.spec.platform == 'darwin' }}
|
||||||
@ -189,6 +190,7 @@ jobs:
|
|||||||
path: builds
|
path: builds
|
||||||
|
|
||||||
package-distribution-windows:
|
package-distribution-windows:
|
||||||
|
environment: ${{ github.event.inputs.build-type }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
spec:
|
spec:
|
||||||
@ -196,10 +198,15 @@ jobs:
|
|||||||
platform: win32
|
platform: win32
|
||||||
arch: x64
|
arch: x64
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
|
- runner: windows-latest
|
||||||
|
platform: win32
|
||||||
|
arch: arm64
|
||||||
|
target: aarch64-pc-windows-msvc
|
||||||
runs-on: ${{ matrix.spec.runner }}
|
runs-on: ${{ matrix.spec.runner }}
|
||||||
needs: before-make
|
needs: before-make
|
||||||
outputs:
|
outputs:
|
||||||
FILES_TO_BE_SIGNED: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED }}
|
FILES_TO_BE_SIGNED_x64: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED_x64 }}
|
||||||
|
FILES_TO_BE_SIGNED_arm64: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED_arm64 }}
|
||||||
env:
|
env:
|
||||||
SKIP_GENERATE_ASSETS: 1
|
SKIP_GENERATE_ASSETS: 1
|
||||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||||
@ -243,7 +250,7 @@ jobs:
|
|||||||
id: get_files_to_be_signed
|
id: get_files_to_be_signed
|
||||||
run: |
|
run: |
|
||||||
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/apps/electron/out -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\packages\frontend\apps\electron\out\', '') + '"' }) -join ' ')
|
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/apps/electron/out -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\packages\frontend\apps\electron\out\', '') + '"' }) -join ' ')
|
||||||
"FILES_TO_BE_SIGNED=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
|
"FILES_TO_BE_SIGNED_${{ matrix.spec.arch }}=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
|
||||||
echo $FILES_TO_BE_SIGNED
|
echo $FILES_TO_BE_SIGNED
|
||||||
|
|
||||||
- name: Zip artifacts for faster upload
|
- name: Zip artifacts for faster upload
|
||||||
@ -257,25 +264,35 @@ jobs:
|
|||||||
archive.zip
|
archive.zip
|
||||||
!**/*.map
|
!**/*.map
|
||||||
|
|
||||||
sign-packaged-artifacts-windows:
|
sign-packaged-artifacts-windows_x64:
|
||||||
needs: package-distribution-windows
|
needs: package-distribution-windows
|
||||||
uses: ./.github/workflows/windows-signer.yml
|
uses: ./.github/workflows/windows-signer.yml
|
||||||
with:
|
with:
|
||||||
files: ${{ needs.package-distribution-windows.outputs.FILES_TO_BE_SIGNED }}
|
files: ${{ needs.package-distribution-windows.outputs.FILES_TO_BE_SIGNED_x64 }}
|
||||||
artifact-name: packaged-win32-x64
|
artifact-name: packaged-win32-x64
|
||||||
|
|
||||||
|
sign-packaged-artifacts-windows_arm64:
|
||||||
|
needs: package-distribution-windows
|
||||||
|
uses: ./.github/workflows/windows-signer.yml
|
||||||
|
with:
|
||||||
|
files: ${{ needs.package-distribution-windows.outputs.FILES_TO_BE_SIGNED_arm64 }}
|
||||||
|
artifact-name: packaged-win32-arm64
|
||||||
|
|
||||||
make-windows-installer:
|
make-windows-installer:
|
||||||
needs: sign-packaged-artifacts-windows
|
needs:
|
||||||
|
- sign-packaged-artifacts-windows_x64
|
||||||
|
- sign-packaged-artifacts-windows_arm64
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
spec:
|
spec:
|
||||||
- runner: windows-latest
|
- platform: win32
|
||||||
platform: win32
|
|
||||||
arch: x64
|
arch: x64
|
||||||
target: x86_64-pc-windows-msvc
|
- platform: win32
|
||||||
runs-on: ${{ matrix.spec.runner }}
|
arch: arm64
|
||||||
|
runs-on: windows-latest
|
||||||
outputs:
|
outputs:
|
||||||
FILES_TO_BE_SIGNED: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED }}
|
FILES_TO_BE_SIGNED_x64: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED_x64 }}
|
||||||
|
FILES_TO_BE_SIGNED_arm64: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED_arm64 }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Version
|
- name: Setup Version
|
||||||
@ -288,6 +305,8 @@ jobs:
|
|||||||
extra-flags: workspaces focus @affine/electron @affine/monorepo
|
extra-flags: workspaces focus @affine/electron @affine/monorepo
|
||||||
hard-link-nm: false
|
hard-link-nm: false
|
||||||
nmHoistingLimits: workspaces
|
nmHoistingLimits: workspaces
|
||||||
|
env:
|
||||||
|
npm_config_arch: ${{ matrix.spec.arch }}
|
||||||
- name: Download and overwrite packaged artifacts
|
- name: Download and overwrite packaged artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -309,7 +328,7 @@ jobs:
|
|||||||
id: get_files_to_be_signed
|
id: get_files_to_be_signed
|
||||||
run: |
|
run: |
|
||||||
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/apps/electron/out/${{ env.BUILD_TYPE }}/make -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\packages\frontend\apps\electron\out\${{ env.BUILD_TYPE }}\make\', '') + '"' }) -join ' ')
|
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/apps/electron/out/${{ env.BUILD_TYPE }}/make -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\packages\frontend\apps\electron\out\${{ env.BUILD_TYPE }}\make\', '') + '"' }) -join ' ')
|
||||||
"FILES_TO_BE_SIGNED=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
|
"FILES_TO_BE_SIGNED_${{ matrix.spec.arch }}=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
|
||||||
echo $FILES_TO_BE_SIGNED
|
echo $FILES_TO_BE_SIGNED
|
||||||
|
|
||||||
- name: Save installer for signing
|
- name: Save installer for signing
|
||||||
@ -318,22 +337,36 @@ jobs:
|
|||||||
name: installer-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
|
name: installer-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
|
||||||
path: archive.zip
|
path: archive.zip
|
||||||
|
|
||||||
sign-installer-artifacts-windows:
|
sign-installer-artifacts-windows-x64:
|
||||||
needs: make-windows-installer
|
needs: make-windows-installer
|
||||||
uses: ./.github/workflows/windows-signer.yml
|
uses: ./.github/workflows/windows-signer.yml
|
||||||
with:
|
with:
|
||||||
files: ${{ needs.make-windows-installer.outputs.FILES_TO_BE_SIGNED }}
|
files: ${{ needs.make-windows-installer.outputs.FILES_TO_BE_SIGNED_x64 }}
|
||||||
artifact-name: installer-win32-x64
|
artifact-name: installer-win32-x64
|
||||||
|
|
||||||
|
sign-installer-artifacts-windows-arm64:
|
||||||
|
needs: make-windows-installer
|
||||||
|
uses: ./.github/workflows/windows-signer.yml
|
||||||
|
with:
|
||||||
|
files: ${{ needs.make-windows-installer.outputs.FILES_TO_BE_SIGNED_arm64 }}
|
||||||
|
artifact-name: installer-win32-arm64
|
||||||
|
|
||||||
finalize-installer-windows:
|
finalize-installer-windows:
|
||||||
needs: [sign-installer-artifacts-windows, before-make]
|
needs:
|
||||||
|
[
|
||||||
|
sign-installer-artifacts-windows-x64,
|
||||||
|
sign-installer-artifacts-windows-arm64,
|
||||||
|
before-make,
|
||||||
|
]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
spec:
|
spec:
|
||||||
- runner: windows-latest
|
- runner: windows-latest
|
||||||
platform: win32
|
platform: win32
|
||||||
arch: x64
|
arch: x64
|
||||||
target: x86_64-pc-windows-msvc
|
- runner: windows-latest
|
||||||
|
platform: win32
|
||||||
|
arch: arm64
|
||||||
runs-on: ${{ matrix.spec.runner }}
|
runs-on: ${{ matrix.spec.runner }}
|
||||||
steps:
|
steps:
|
||||||
- name: Download and overwrite installer artifacts
|
- name: Download and overwrite installer artifacts
|
||||||
@ -347,16 +380,16 @@ jobs:
|
|||||||
- name: Save artifacts
|
- name: Save artifacts
|
||||||
run: |
|
run: |
|
||||||
mkdir -p builds
|
mkdir -p builds
|
||||||
mv packages/frontend/apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-x64.zip
|
mv packages/frontend/apps/electron/out/*/make/zip/win32/${{ matrix.spec.arch }}/AFFiNE*-win32-${{ matrix.spec.arch }}-*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.zip
|
||||||
mv packages/frontend/apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-x64.exe
|
mv packages/frontend/apps/electron/out/*/make/squirrel.windows/${{ matrix.spec.arch }}/*.exe ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.exe
|
||||||
mv packages/frontend/apps/electron/out/*/make/nsis.windows/x64/*.exe ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-x64.nsis.exe
|
mv packages/frontend/apps/electron/out/*/make/nsis.windows/${{ matrix.spec.arch }}/*.exe ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.nsis.exe
|
||||||
|
|
||||||
- uses: actions/attest-build-provenance@v1
|
- uses: actions/attest-build-provenance@v1
|
||||||
with:
|
with:
|
||||||
subject-path: |
|
subject-path: |
|
||||||
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-x64.zip
|
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.zip
|
||||||
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-x64.exe
|
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.exe
|
||||||
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-x64.nsis.exe
|
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.nsis.exe
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@ -391,6 +424,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: affine-win32-x64-builds
|
name: affine-win32-x64-builds
|
||||||
path: ./
|
path: ./
|
||||||
|
- name: Download Artifacts (windows-arm64)
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: affine-win32-arm64-builds
|
||||||
|
path: ./
|
||||||
- name: Download Artifacts (linux-x64)
|
- name: Download Artifacts (linux-x64)
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { parseArgs } from 'node:util';
|
||||||
|
|
||||||
|
import debug from 'debug';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
const log = debug('affine:make-env');
|
||||||
|
|
||||||
const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);
|
const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);
|
||||||
|
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
@ -36,15 +40,27 @@ const icnsPath = path.join(
|
|||||||
const iconPngPath = path.join(ROOT, './resources/icons/icon.png');
|
const iconPngPath = path.join(ROOT, './resources/icons/icon.png');
|
||||||
|
|
||||||
const iconUrl = `https://cdn.affine.pro/app-icons/icon_${buildType}.ico`;
|
const iconUrl = `https://cdn.affine.pro/app-icons/icon_${buildType}.ico`;
|
||||||
const arch =
|
|
||||||
process.argv.indexOf('--arch') > 0
|
|
||||||
? process.argv[process.argv.indexOf('--arch') + 1]
|
|
||||||
: process.arch;
|
|
||||||
|
|
||||||
const platform =
|
log(`buildType=${buildType}, productName=${productName}, icoPath=${icoPath}`);
|
||||||
process.argv.indexOf('--platform') > 0
|
|
||||||
? process.argv[process.argv.indexOf('--platform') + 1]
|
const {
|
||||||
: process.platform;
|
values: { arch, platform },
|
||||||
|
} = parseArgs({
|
||||||
|
options: {
|
||||||
|
arch: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'The architecture to build for',
|
||||||
|
default: process.arch,
|
||||||
|
},
|
||||||
|
platform: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'The platform to build for',
|
||||||
|
default: process.platform,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
log(`parsed args: arch=${arch}, platform=${platform}`);
|
||||||
|
|
||||||
const appIdMap = {
|
const appIdMap = {
|
||||||
internal: 'pro.affine.internal',
|
internal: 'pro.affine.internal',
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
ROOT,
|
ROOT,
|
||||||
} from './make-env.js';
|
} from './make-env.js';
|
||||||
|
|
||||||
const log = debug('make-nsis');
|
const log = debug('affine:make-nsis');
|
||||||
|
|
||||||
async function make() {
|
async function make() {
|
||||||
const appName = productName;
|
const appName = productName;
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
ROOT,
|
ROOT,
|
||||||
} from './make-env.js';
|
} from './make-env.js';
|
||||||
|
|
||||||
const log = debug('make-squirrel');
|
const log = debug('affine:make-squirrel');
|
||||||
|
|
||||||
// taking from https://github.com/electron/forge/blob/main/packages/maker/squirrel/src/MakerSquirrel.ts
|
// taking from https://github.com/electron/forge/blob/main/packages/maker/squirrel/src/MakerSquirrel.ts
|
||||||
// it was for forge's maker, but can be used standalone as well
|
// it was for forge's maker, but can be used standalone as well
|
||||||
@ -29,6 +29,7 @@ async function make() {
|
|||||||
buildType,
|
buildType,
|
||||||
`${appName}-${platform}-${arch}`
|
`${appName}-${platform}-${arch}`
|
||||||
);
|
);
|
||||||
|
log('making squirrel.windows: appDirectory', appDirectory);
|
||||||
await fs.ensureDir(outPath);
|
await fs.ensureDir(outPath);
|
||||||
|
|
||||||
const packageJSON = await fs.readJson(path.resolve(ROOT, 'package.json'));
|
const packageJSON = await fs.readJson(path.resolve(ROOT, 'package.json'));
|
||||||
@ -40,7 +41,7 @@ async function make() {
|
|||||||
exe: `${appName}.exe`,
|
exe: `${appName}.exe`,
|
||||||
setupExe: `${appName}-${packageJSON.version} Setup.exe`,
|
setupExe: `${appName}-${packageJSON.version} Setup.exe`,
|
||||||
version: packageJSON.version,
|
version: packageJSON.version,
|
||||||
appDirectory: appDirectory,
|
appDirectory,
|
||||||
outputDirectory: outPath,
|
outputDirectory: outPath,
|
||||||
iconUrl: iconUrl,
|
iconUrl: iconUrl,
|
||||||
setupIcon: icoPath,
|
setupIcon: icoPath,
|
||||||
|
Loading…
Reference in New Issue
Block a user