mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 11:15:01 +03:00
fix #15732 fix #15750 fix #15548 #### PR Dependency Tree * **PR #15751** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal)
107 lines
3.8 KiB
YAML
107 lines
3.8 KiB
YAML
name: Build Desktop Candidate
|
|
'on':
|
|
workflow_call:
|
|
inputs:
|
|
build_type:
|
|
required: true
|
|
type: string
|
|
app_version:
|
|
required: true
|
|
type: string
|
|
git_short_hash:
|
|
required: true
|
|
type: string
|
|
matrix:
|
|
type: string
|
|
required: true
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.runner }}
|
|
env:
|
|
BUILD_TYPE: ${{ inputs.build_type }}
|
|
RELEASE_VERSION: ${{ inputs.app_version }}
|
|
DEBUG: affine:*,napi:*
|
|
APP_NAME: affine
|
|
MACOSX_DEPLOYMENT_TARGET: '12.0'
|
|
SKIP_GENERATE_ASSETS: 1
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
SENTRY_PROJECT: affine
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
|
SENTRY_RELEASE: ${{ inputs.app_version }}
|
|
AFFINE_UNSIGNED_PACKAGE: '1'
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- name: Setup Version
|
|
uses: ./.github/actions/setup-version
|
|
with:
|
|
app-version: ${{ inputs.app_version }}
|
|
- name: Setup Node.js
|
|
timeout-minutes: 10
|
|
uses: ./.github/actions/setup-node
|
|
with:
|
|
extra-flags: workspaces focus @affine/electron @affine/monorepo @affine/nbstore @toeverything/infra
|
|
hard-link-nm: false
|
|
nmHoistingLimits: workspaces
|
|
enableScripts: true
|
|
- name: Build AFFiNE native
|
|
uses: ./.github/actions/build-rust
|
|
with:
|
|
target: ${{ matrix.rustTarget }}
|
|
package: '@affine/native'
|
|
cache-key: desktop-${{ matrix.runner }}
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: desktop-web
|
|
path: packages/frontend/apps/electron/resources/web-static
|
|
- name: Build Desktop Layers
|
|
run: yarn affine @affine/electron build
|
|
- name: Remove nbstore node_modules (darwin/linux)
|
|
if: ${{ matrix.platform != 'win32' }}
|
|
shell: bash
|
|
run: 'cargo clean
|
|
|
|
rm -rf packages/frontend/apps/electron/node_modules/@affine/nbstore/node_modules/@blocksuite
|
|
|
|
rm -rf packages/frontend/apps/electron/node_modules/@affine/native/node_modules
|
|
|
|
'
|
|
- name: Remove nbstore node_modules (windows)
|
|
if: ${{ matrix.platform == 'win32' }}
|
|
shell: bash
|
|
run:
|
|
'rm -rf packages/frontend/apps/electron/node_modules/@affine/nbstore/node_modules/@blocksuite/affine/node_modules
|
|
|
|
rm -rf packages/frontend/apps/electron/node_modules/@affine/native/node_modules
|
|
|
|
'
|
|
- name: Package unsigned application
|
|
run: yarn affine @affine/electron package --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
|
|
env:
|
|
SKIP_WEB_BUILD: '1'
|
|
HOIST_NODE_MODULES: '1'
|
|
NODE_OPTIONS: --max-old-space-size=14384
|
|
- name: Verify packaged Linux native modules
|
|
if: ${{ matrix.platform == 'linux' }}
|
|
shell: bash
|
|
run: |
|
|
native_modules=(packages/frontend/apps/electron/out/"$BUILD_TYPE"/*-linux-${{ matrix.arch }}/resources/app.asar.unpacked/dist/*.node)
|
|
node -e 'for (const file of process.argv.slice(1)) { require(require("node:path").resolve(file)); console.log("Loaded", file); }' "${native_modules[@]}"
|
|
- name: Archive packaged application
|
|
shell: bash
|
|
run:
|
|
tar -czf candidate-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz -C packages/frontend/apps/electron
|
|
out resources
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
overwrite: true
|
|
name: candidate-desktop-${{ matrix.platform }}-${{ matrix.arch }}
|
|
path: candidate-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
|
|
if-no-files-found: error
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(inputs.matrix) }}
|
|
continue-on-error: ${{ !matrix.required }}
|