There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
build(electron): add internal release channel (#2309)
Himself65f82ea5d9c446
diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.ymlindex 61e5ddab35..977f2cedcb 100644--- a/.github/workflows/nightly-build.yml+++ b/.github/workflows/nightly-build.yml@@ -21,7 +21,8 @@ concurrency:cancel-in-progress: trueenv:- BUILD_TYPE: canary+ BUILD_TYPE: internal+ RELEASE_VERSION: ${{ github.ref_name }}-${{ github.sha }}jobs:before-make:@@ -136,3 +137,62 @@ jobs:with:name: affine-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}-buildspath: builds++ release:+ needs: make-distribution+ runs-on: ubuntu-latest++ steps:+ - name: Download Artifacts (macos-x64)+ uses: actions/download-artifact@v3+ with:+ name: affine-macos-x64-builds+ path: ./+ - name: Download Artifacts (macos-arm64)+ uses: actions/download-artifact@v3+ with:+ name: affine-macos-arm64-builds+ path: ./+ - name: Download Artifacts (windows-x64)+ uses: actions/download-artifact@v3+ with:+ name: affine-windows-x64-builds+ path: ./+ - name: Download Artifacts (linux-x64)+ uses: actions/download-artifact@v3+ with:+ name: affine-linux-x64-builds+ path: ./+ - name: Download Artifacts+ uses: actions/download-artifact@v3+ with:+ name: release-yml-build-script+ path: ./+ - name: Setup Node.js+ uses: actions/setup-node@v3+ with:+ node-version: 18+ - name: Generate Release yml+ run: |+ node generate-yml.js+ env:+ RELEASE_VERSION: ${{ env.RELEASE_VERSION }}+ - name: Create Release Draft+ uses: softprops/action-gh-release@v1+ env:+ GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}+ with:+ repository: 'toeverything/AFFiNE-Releases'+ name: ${{ env.RELEASE_VERSION }}+ tag_name: ${{ env.RELEASE_VERSION }}+ prerelease: true+ files: |+ ./VERSION+ ./*.zip+ ./*.dmg+ ./*.exe+ ./*.nupkg+ ./RELEASES+ ./*.AppImage+ ./*.apk+ ./*.ymldiff --git a/apps/electron/forge.config.js b/apps/electron/forge.config.jsindex 4352564266..480e09fc85 100644--- a/apps/electron/forge.config.js+++ b/apps/electron/forge.config.js@@ -1,11 +1,16 @@/* eslint-disable @typescript-eslint/no-var-requires */+const { z } = require('zod');+const {utils: { fromBuildIdentifier },} = require('@electron-forge/core');const path = require('node:path');-const buildType = (process.env.BUILD_TYPE || 'stable').trim().toLowerCase();+const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);++const envBuildType = (process.env.BUILD_TYPE || 'canary').trim().toLowerCase();+const buildType = ReleaseTypeSchema.parse(envBuildType);const stableBuild = buildType === 'stable';const productName = !stableBuild ? `AFFiNE-${buildType}` : 'AFFiNE';const icoPath = !stableBuilddiff --git a/apps/electron/layers/main/src/handlers/updater/index.ts b/apps/electron/layers/main/src/handlers/updater/index.tsindex 8852085b69..505cbd52da 100644--- a/apps/electron/layers/main/src/handlers/updater/index.ts+++ b/apps/electron/layers/main/src/handlers/updater/index.ts@@ -1,8 +1,8 @@import type { NamespaceHandlers } from '../type';-import { updateClient } from './updater';export const updaterHandlers = {updateClient: async () => {+ const { updateClient } = await import('./updater');return updateClient();},} satisfies NamespaceHandlers;diff --git a/apps/electron/layers/main/src/handlers/updater/updater.ts b/apps/electron/layers/main/src/handlers/updater/updater.tsindex ef09de9e3e..019d593e8e 100644--- a/apps/electron/layers/main/src/handlers/updater/updater.ts+++ b/apps/electron/layers/main/src/handlers/updater/updater.ts@@ -1,10 +1,21 @@import type { AppUpdater } from 'electron-updater';+import { z } from 'zod';import { isMacOS } from '../../../../utils';import { updaterSubjects } from '../../events/updater';import { logger } from '../../logger';-const buildType = (process.env.BUILD_TYPE || 'canary').trim().toLowerCase();+export const ReleaseTypeSchema = z.enum([+ 'stable',+ 'beta',+ 'canary',+ 'internal',+]);++export const envBuildType = (process.env.BUILD_TYPE || 'canary')+ .trim()+ .toLowerCase();+export const buildType = ReleaseTypeSchema.parse(envBuildType);const mode = process.env.NODE_ENV;const isDev = mode === 'development';@@ -17,8 +28,7 @@ export const updateClient = async () => {export const registerUpdater = async () => {// require it will cause some side effects and will break generate-main-exposed-meta,// so we wrap it in a function- // eslint-disable-next-line @typescript-eslint/no-var-requires- const { autoUpdater } = require('electron-updater');+ const { autoUpdater } = await import('electron-updater');_autoUpdater = autoUpdater;@@ -33,7 +43,7 @@ export const registerUpdater = async () => {_autoUpdater.setFeedURL({channel: buildType,provider: 'github',- repo: 'AFFiNE',+ repo: buildType !== 'internal' ? 'AFFiNE' : 'AFFiNE-Releases',owner: 'toeverything',releaseType: buildType === 'stable' ? 'release' : 'prerelease',});diff --git a/apps/electron/layers/main/tsconfig.json b/apps/electron/layers/main/tsconfig.jsondeleted file mode 100644index cf93d810ce..0000000000--- a/apps/electron/layers/main/tsconfig.json+++ /dev/null@@ -1,15 +0,0 @@-{- "compilerOptions": {- "module": "esnext",- "target": "esnext",- "sourceMap": false,- "moduleResolution": "Node",- "skipLibCheck": true,- "strict": true,- "isolatedModules": true,- "allowSyntheticDefaultImports": true,-- "types": ["node"]- },- "include": ["src/**/*.ts", "../../types/**/*.d.ts", "index.ts", "../utils.ts"]-}diff --git a/apps/electron/layers/preload/tsconfig.json b/apps/electron/layers/preload/tsconfig.jsondeleted file mode 100644index a654ba3c08..0000000000--- a/apps/electron/layers/preload/tsconfig.json+++ /dev/null@@ -1,14 +0,0 @@-{- "compilerOptions": {- "module": "esnext",- "target": "esnext",- "sourceMap": false,- "moduleResolution": "Node",- "skipLibCheck": true,- "strict": true,- "isolatedModules": true,-- "types": ["node"]- },- "include": ["src/**/*.ts", "../../types/**/*.d.ts"]-}diff --git a/apps/electron/resources/icons/icon_internal.icns b/apps/electron/resources/icons/icon_internal.icnsnew file mode 100644index 0000000000..e33e41e29dBinary files /dev/null and b/apps/electron/resources/icons/icon_internal.icns differdiff --git a/apps/electron/resources/icons/icon_internal.ico b/apps/electron/resources/icons/icon_internal.iconew file mode 100644index 0000000000..d9ba6c8c48Binary files /dev/null and b/apps/electron/resources/icons/icon_internal.ico differdiff --git a/apps/electron/tsconfig.json b/apps/electron/tsconfig.jsonindex 59f8b6d127..680477809c 100644--- a/apps/electron/tsconfig.json+++ b/apps/electron/tsconfig.json@@ -1,19 +1,18 @@{"extends": "../../tsconfig.json","compilerOptions": {- "composite": true,+ "skipLibCheck": true,"target": "ESNext","module": "ESNext","emitDecoratorMetadata": true,"experimentalDecorators": true,- "moduleResolution": "bundler",- "isolatedModules": false,- "resolveJsonModule": true,"types": ["node"],"outDir": "dist",- "noEmit": false+ "moduleResolution": "node",+ "resolveJsonModule": true,+ "isolatedModules": true},- "include": ["layers", "types", "package.json"],+ "include": ["**/*.ts", "**/*.tsx", "package.json"],"exclude": ["out", "dist", "node_modules"],"references": [{