build: add canary build (#1986)
Co-authored-by: Himself65 <himself65@outlook.com> Co-authored-by: Horus <lhlxtl@gmail.com>
This commit is contained in:
96
.github/workflows/release-desktop-app.yml
vendored
96
.github/workflows/release-desktop-app.yml
vendored
@@ -17,6 +17,11 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
|
is-canary:
|
||||||
|
description: 'Canary Release? The app will be named as "AFFiNE Canary"'
|
||||||
|
type: boolean
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
actions: write
|
actions: write
|
||||||
@@ -29,9 +34,12 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILD_TYPE: ${{ github.event.inputs.is-canary == 'true' && 'canary' || 'stable' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
make-macos:
|
make-macos:
|
||||||
environment: production
|
environment: ${{ github.ref_name == 'master' && 'production' || 'development' }}
|
||||||
env:
|
env:
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
@@ -62,19 +70,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
electron-workspace-install: true
|
electron-workspace-install: true
|
||||||
|
|
||||||
- name: install Rust stable
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: add arm64 target
|
|
||||||
if: matrix.arch == 'arm64'
|
|
||||||
run: rustup target add aarch64-apple-darwin
|
|
||||||
|
|
||||||
- name: Rust cache
|
|
||||||
uses: swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
key: ${{ matrix.arch }}
|
|
||||||
workspaces: './packages/octobase-node -> target'
|
|
||||||
|
|
||||||
- name: Signing By Apple Developer ID
|
- name: Signing By Apple Developer ID
|
||||||
uses: apple-actions/import-codesign-certs@v2
|
uses: apple-actions/import-codesign-certs@v2
|
||||||
with:
|
with:
|
||||||
@@ -88,7 +83,7 @@ jobs:
|
|||||||
- name: Save artifacts
|
- name: Save artifacts
|
||||||
run: |
|
run: |
|
||||||
mkdir -p builds
|
mkdir -p builds
|
||||||
mv apps/electron/out/make/AFFiNE.dmg ./builds/affine-darwin-${{ matrix.arch }}.dmg
|
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-darwin-${{ matrix.arch }}.dmg
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -98,11 +93,8 @@ jobs:
|
|||||||
|
|
||||||
make-windows:
|
make-windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
environment: production
|
environment: ${{ github.ref_name == 'master' && 'production' || 'development' }}
|
||||||
env:
|
env:
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
||||||
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||||
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
|
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
|
||||||
@@ -125,14 +117,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
electron-workspace-install: true
|
electron-workspace-install: true
|
||||||
|
|
||||||
- name: install Rust stable
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Rust cache
|
|
||||||
uses: swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './packages/octobase-node -> target'
|
|
||||||
|
|
||||||
- name: make build
|
- name: make build
|
||||||
run: yarn make-windows-x64
|
run: yarn make-windows-x64
|
||||||
working-directory: apps/electron
|
working-directory: apps/electron
|
||||||
@@ -140,19 +124,60 @@ jobs:
|
|||||||
- name: Save windows artifacts
|
- name: Save windows artifacts
|
||||||
run: |
|
run: |
|
||||||
mkdir -p builds
|
mkdir -p builds
|
||||||
mv apps/electron/out/make/zip/win32/x64/AFFiNE-win32-x64-*.zip ./builds/affine-windows-x64.zip
|
mv apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
|
||||||
mv apps/electron/out/make/squirrel.windows/x64/*.exe ./builds/affine-windows-x64.exe
|
mv apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
|
||||||
mv apps/electron/out/make/squirrel.windows/x64/*.msi ./builds/affine-windows-x64.msi
|
mv apps/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
|
||||||
mv apps/electron/out/make/squirrel.windows/x64/*.nupkg ./builds/affine-windows-x64.nupkg
|
mv apps/electron/out/*/make/squirrel.windows/x64/*.nupkg ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.nupkg
|
||||||
mv apps/electron/out/make/squirrel.windows/x64/RELEASES ./builds/RELEASES
|
mv apps/electron/out/*/make/squirrel.windows/x64/RELEASES ./builds/RELEASES
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: affine-windows-x64-builds
|
name: affine-windows-x64-builds
|
||||||
path: builds
|
path: builds
|
||||||
|
|
||||||
|
make-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: ${{ github.ref_name == 'master' && 'production' || 'development' }}
|
||||||
|
env:
|
||||||
|
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||||
|
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||||
|
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
|
||||||
|
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
|
||||||
|
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
|
||||||
|
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
|
||||||
|
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
||||||
|
AFFINE_GOOGLE_CLIENT_ID: ${{ secrets.AFFINE_GOOGLE_CLIENT_ID }}
|
||||||
|
AFFINE_GOOGLE_CLIENT_SECRET: ${{ secrets.AFFINE_GOOGLE_CLIENT_SECRET }}
|
||||||
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||||
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||||
|
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }}
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
API_SERVER_PROFILE: prod
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
|
with:
|
||||||
|
electron-workspace-install: true
|
||||||
|
|
||||||
|
- name: make build
|
||||||
|
run: yarn make
|
||||||
|
working-directory: apps/electron
|
||||||
|
|
||||||
|
- name: Save Linux artifacts
|
||||||
|
run: |
|
||||||
|
mkdir -p builds
|
||||||
|
mv apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: affine-Linux-x64-builds
|
||||||
|
path: builds
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [make-macos, make-windows]
|
needs: [make-macos, make-windows, make-linux]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download MacOS x64 Artifacts
|
- name: Download MacOS x64 Artifacts
|
||||||
@@ -171,6 +196,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: affine-windows-x64-builds
|
name: affine-windows-x64-builds
|
||||||
path: ./
|
path: ./
|
||||||
|
- name: Download Linux Artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: affine-Linux-x64-builds
|
||||||
|
path: ./
|
||||||
|
|
||||||
- name: Create Release Draft
|
- name: Create Release Draft
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
@@ -1,7 +1,30 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
|
const {
|
||||||
|
utils: { fromBuildIdentifier },
|
||||||
|
} = require('@electron-forge/core');
|
||||||
|
|
||||||
|
const isCanary = process.env.BUILD_TYPE === 'canary';
|
||||||
|
|
||||||
|
const productName = isCanary ? 'AFFiNE-Canary' : 'AFFiNE';
|
||||||
|
const icoPath = isCanary
|
||||||
|
? './resources/icons/icon_canary.ico'
|
||||||
|
: './resources/icons/icon.ico';
|
||||||
|
const icnsPath = isCanary
|
||||||
|
? './resources/icons/icon_canary.icns'
|
||||||
|
: './resources/icons/icon.icns';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import('@electron-forge/shared-types').ForgeConfig}
|
||||||
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
buildIdentifier: isCanary ? 'canary' : 'stable',
|
||||||
packagerConfig: {
|
packagerConfig: {
|
||||||
name: 'AFFiNE',
|
name: productName,
|
||||||
icon: './resources/icons/icon.icns',
|
appBundleId: fromBuildIdentifier({
|
||||||
|
canary: 'pro.affine.canary',
|
||||||
|
stable: 'pro.affine.app',
|
||||||
|
}),
|
||||||
|
icon: icnsPath,
|
||||||
osxSign: {
|
osxSign: {
|
||||||
identity: 'Developer ID Application: TOEVERYTHING PTE. LTD.',
|
identity: 'Developer ID Application: TOEVERYTHING PTE. LTD.',
|
||||||
'hardened-runtime': true,
|
'hardened-runtime': true,
|
||||||
@@ -20,7 +43,7 @@ module.exports = {
|
|||||||
name: '@electron-forge/maker-dmg',
|
name: '@electron-forge/maker-dmg',
|
||||||
config: {
|
config: {
|
||||||
format: 'ULFO',
|
format: 'ULFO',
|
||||||
icon: './resources/icons/icon.icns',
|
icon: icnsPath,
|
||||||
name: 'AFFiNE',
|
name: 'AFFiNE',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -28,20 +51,26 @@ module.exports = {
|
|||||||
name: '@electron-forge/maker-zip',
|
name: '@electron-forge/maker-zip',
|
||||||
config: {
|
config: {
|
||||||
name: 'affine',
|
name: 'affine',
|
||||||
iconUrl: './resources/icons/icon.ico',
|
iconUrl: icoPath,
|
||||||
setupIcon: './resources/icons/icon.ico',
|
setupIcon: icoPath,
|
||||||
|
platforms: ['darwin', 'linux', 'win32'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '@electron-forge/maker-squirrel',
|
name: '@electron-forge/maker-squirrel',
|
||||||
config: {
|
config: {
|
||||||
name: 'AFFiNE',
|
name: 'AFFiNE',
|
||||||
setupIcon: './resources/icons/icon.ico',
|
setupIcon: icoPath,
|
||||||
// loadingGif: './resources/icons/loading.gif',
|
// loadingGif: './resources/icons/loading.gif',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
hooks: {
|
hooks: {
|
||||||
|
readPackageJson: async (_, packageJson) => {
|
||||||
|
// we want different package name for canary build
|
||||||
|
// so stable and canary will not share the same app data
|
||||||
|
packageJson.productName = productName;
|
||||||
|
},
|
||||||
generateAssets: async (_, platform, arch) => {
|
generateAssets: async (_, platform, arch) => {
|
||||||
const { $ } = await import('zx');
|
const { $ } = await import('zx');
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import * as os from 'node:os';
|
import * as os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { Storage } from '@affine/octobase-node';
|
|
||||||
import { app, shell } from 'electron';
|
import { app, shell } from 'electron';
|
||||||
import { BrowserWindow, ipcMain, nativeTheme } from 'electron';
|
import { BrowserWindow, ipcMain, nativeTheme } from 'electron';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
@@ -16,16 +15,7 @@ fs.ensureDirSync(AFFINE_ROOT);
|
|||||||
|
|
||||||
const logger = console;
|
const logger = console;
|
||||||
|
|
||||||
// todo: rethink this
|
|
||||||
export const appState = {
|
|
||||||
storage: new Storage(path.join(AFFINE_ROOT, 'test.db')),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const registerHandlers = () => {
|
export const registerHandlers = () => {
|
||||||
ipcMain.handle('octo:workspace-sync', async (_, id) => {
|
|
||||||
return appState.storage.sync(id, '');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('ui:theme-change', async (_, theme) => {
|
ipcMain.handle('ui:theme-change', async (_, theme) => {
|
||||||
nativeTheme.themeSource = theme;
|
nativeTheme.themeSource = theme;
|
||||||
logger.info('theme change', theme);
|
logger.info('theme change', theme);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@affine/electron",
|
"name": "@affine/electron",
|
||||||
"productName": "AFFiNE",
|
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.3",
|
"version": "0.5.3",
|
||||||
"author": "affine",
|
"author": "affine",
|
||||||
@@ -14,11 +13,11 @@
|
|||||||
"dev": "cross-env NODE_ENV=development node scripts/dev.mjs",
|
"dev": "cross-env NODE_ENV=development node scripts/dev.mjs",
|
||||||
"prod": "cross-env NODE_ENV=production node scripts/dev.mjs",
|
"prod": "cross-env NODE_ENV=production node scripts/dev.mjs",
|
||||||
"generate-assets": "zx scripts/generate-assets.mjs",
|
"generate-assets": "zx scripts/generate-assets.mjs",
|
||||||
|
"package": "electron-forge package",
|
||||||
"make": "electron-forge make",
|
"make": "electron-forge make",
|
||||||
"make-macos-arm64": "electron-forge make --platform=darwin --arch=arm64",
|
"make-macos-arm64": "electron-forge make --platform=darwin --arch=arm64",
|
||||||
"make-macos-x64": "electron-forge make --platform=darwin --arch=x64",
|
"make-macos-x64": "electron-forge make --platform=darwin --arch=x64",
|
||||||
"make-windows-x64": "electron-forge make --platform=win32 --arch=x64",
|
"make-windows-x64": "electron-forge make --platform=win32 --arch=x64",
|
||||||
"build:octobase-node": "yarn workspace @affine/octobase-node build",
|
|
||||||
"postinstall": "ELECTRON_RUN_AS_NODE=1 electron scripts/update-electron-vendors.mjs"
|
"postinstall": "ELECTRON_RUN_AS_NODE=1 electron scripts/update-electron-vendors.mjs"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
@@ -26,7 +25,6 @@
|
|||||||
},
|
},
|
||||||
"main": "./dist/layers/main/index.js",
|
"main": "./dist/layers/main/index.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@affine/octobase-node": "workspace:*",
|
|
||||||
"@electron-forge/cli": "^6.1.1",
|
"@electron-forge/cli": "^6.1.1",
|
||||||
"@electron-forge/core": "^6.1.1",
|
"@electron-forge/core": "^6.1.1",
|
||||||
"@electron-forge/core-utils": "^6.1.1",
|
"@electron-forge/core-utils": "^6.1.1",
|
||||||
|
|||||||
BIN
apps/electron/resources/icons/icon_canary.icns
Normal file
BIN
apps/electron/resources/icons/icon_canary.icns
Normal file
Binary file not shown.
BIN
apps/electron/resources/icons/icon_canary.ico
Normal file
BIN
apps/electron/resources/icons/icon_canary.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
@@ -60,17 +60,6 @@ await fs.move(affineWebOutDir, publicAffineOutDir, { overwrite: true });
|
|||||||
await buildLayers();
|
await buildLayers();
|
||||||
echo('Build layers done');
|
echo('Build layers done');
|
||||||
|
|
||||||
// step 3: build octobase-node
|
|
||||||
let buildOctobaseNode = 'yarn workspace @affine/octobase-node build';
|
|
||||||
if (process.env.TARGET) {
|
|
||||||
buildOctobaseNode += ` --target=${process.env.TARGET}`;
|
|
||||||
}
|
|
||||||
await $([buildOctobaseNode]);
|
|
||||||
|
|
||||||
// step 4: copy octobase-node to electron dist
|
|
||||||
await fs.ensureDir('./apps/electron/dist/layers/main/');
|
|
||||||
await $`cp ./packages/octobase-node/octobase.*.node ./apps/electron/dist/layers/main/`;
|
|
||||||
|
|
||||||
/// --------
|
/// --------
|
||||||
/// --------
|
/// --------
|
||||||
/// --------
|
/// --------
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@affine/electron@workspace:."
|
resolution: "@affine/electron@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@affine/octobase-node": "workspace:*"
|
|
||||||
"@electron-forge/cli": ^6.1.1
|
"@electron-forge/cli": ^6.1.1
|
||||||
"@electron-forge/core": ^6.1.1
|
"@electron-forge/core": ^6.1.1
|
||||||
"@electron-forge/core-utils": ^6.1.1
|
"@electron-forge/core-utils": ^6.1.1
|
||||||
@@ -192,7 +191,7 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@affine/octobase-node@workspace:*, @affine/octobase-node@workspace:../../packages/octobase-node":
|
"@affine/octobase-node@workspace:../../packages/octobase-node":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@affine/octobase-node@workspace:../../packages/octobase-node"
|
resolution: "@affine/octobase-node@workspace:../../packages/octobase-node"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user