ci: avoid twice by nx (#8279)

This commit is contained in:
forehalo 2024-09-18 05:09:42 +00:00
parent ccd630a2b0
commit e7ac43f0f7
No known key found for this signature in database
GPG Key ID: 56709255DC7EC728
7 changed files with 11 additions and 14 deletions

View File

@ -296,8 +296,8 @@ jobs:
path: ./packages/backend/native/server-native.node path: ./packages/backend/native/server-native.node
if-no-files-found: error if-no-files-found: error
build-web: build-electron-renderer:
name: Build @affine/web name: Build @affine/electron renderer
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -307,9 +307,9 @@ jobs:
with: with:
electron-install: false electron-install: false
full-cache: true full-cache: true
- name: Build Web - name: Build Electron renderer
# always skip cache because its fast, and cache configuration is always changing # always skip cache because its fast, and cache configuration is always changing
run: yarn nx build @affine/web --skip-nx-cache run: yarn build
env: env:
DISTRIBUTION: desktop DISTRIBUTION: desktop
- name: zip web - name: zip web
@ -520,7 +520,7 @@ jobs:
test: true, test: true,
} }
needs: needs:
- build-web - build-electron-renderer
- build-native - build-native
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@ -19,8 +19,8 @@
}, },
"scripts": { "scripts": {
"dev": "yarn workspace @affine/cli dev", "dev": "yarn workspace @affine/cli dev",
"build": "yarn workspace @affine/cli bundle",
"dev:electron": "yarn workspace @affine/electron dev", "dev:electron": "yarn workspace @affine/electron dev",
"build": "yarn nx build @affine/web",
"build:electron": "yarn nx build @affine/electron", "build:electron": "yarn nx build @affine/electron",
"build:server-native": "yarn nx run-many -t build -p @affine/server-native", "build:server-native": "yarn nx run-many -t build -p @affine/server-native",
"start:web-static": "yarn workspace @affine/web static-server", "start:web-static": "yarn workspace @affine/web static-server",

View File

@ -60,7 +60,7 @@
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7"
}, },
"scripts": { "scripts": {
"build": "cross-env DISTRIBUTION=admin yarn workspace @affine/cli build", "build": "cross-env DISTRIBUTION=admin yarn workspace @affine/cli bundle",
"update-shadcn": "shadcn-ui add -p src/components/ui" "update-shadcn": "shadcn-ui add -p src/components/ui"
}, },
"exports": { "exports": {

View File

@ -47,12 +47,9 @@ process.env.DISTRIBUTION = 'desktop';
const cwd = repoRootDir; const cwd = repoRootDir;
const { SKIP_NX_CACHE } = process.env;
const nxFlag = SKIP_NX_CACHE ? '--skip-nx-cache' : '';
// step 1: build web dist // step 1: build web dist
if (!process.env.SKIP_WEB_BUILD) { if (!process.env.SKIP_WEB_BUILD) {
spawnSync('yarn', ['nx', 'build', '@affine/web', nxFlag], { spawnSync('yarn', ['build'], {
stdio: 'inherit', stdio: 'inherit',
env: process.env, env: process.env,
cwd, cwd,

View File

@ -5,7 +5,7 @@
"private": true, "private": true,
"browser": "src/index.tsx", "browser": "src/index.tsx",
"scripts": { "scripts": {
"build": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli build", "build": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli bundle",
"dev": "yarn workspace @affine/cli dev", "dev": "yarn workspace @affine/cli dev",
"static-server": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli dev --static" "static-server": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli dev --static"
}, },

View File

@ -5,7 +5,7 @@
"private": true, "private": true,
"browser": "src/index.tsx", "browser": "src/index.tsx",
"scripts": { "scripts": {
"build": "cross-env DISTRIBUTION=web yarn workspace @affine/cli build", "build": "cross-env DISTRIBUTION=web yarn workspace @affine/cli bundle",
"dev": "yarn workspace @affine/cli dev", "dev": "yarn workspace @affine/cli dev",
"static-server": "yarn workspace @affine/cli dev --static" "static-server": "yarn workspace @affine/cli dev --static"
}, },

View File

@ -41,7 +41,7 @@
"webpack-merge": "^6.0.0" "webpack-merge": "^6.0.0"
}, },
"scripts": { "scripts": {
"build": "node --loader ts-node/esm/transpile-only.mjs ./src/bin/build.ts", "bundle": "node --loader ts-node/esm/transpile-only.mjs ./src/bin/build.ts",
"dev": "node --loader ts-node/esm/transpile-only.mjs ./src/bin/dev.ts" "dev": "node --loader ts-node/esm/transpile-only.mjs ./src/bin/dev.ts"
}, },
"version": "0.16.0" "version": "0.16.0"