diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d665c8d3a..e2e7a5a16a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,7 @@ env: APP_NAME: affine COVERAGE: true MACOSX_DEPLOYMENT_TARGET: '10.13' + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} jobs: lint: @@ -70,29 +71,20 @@ jobs: name: Build @affine/web runs-on: ubuntu-latest environment: development + env: + API_SERVER_PROFILE: local + ENABLE_DEBUG_PAGE: 1 + ENABLE_PLUGIN: true + ENABLE_ALL_PAGE_FILTER: true + ENABLE_LEGACY_PROVIDER: true + ENABLE_PRELOADING: false steps: - uses: actions/checkout@v3 - name: Setup Node.js uses: ./.github/actions/setup-node - - name: Cache Next.js - uses: actions/cache@v3 - with: - path: | - ${{ github.workspace }}/apps/web/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- - name: Build Web run: yarn nx build @affine/web - env: - API_SERVER_PROFILE: local - ENABLE_DEBUG_PAGE: 1 - ENABLE_PLUGIN: true - ENABLE_ALL_PAGE_FILTER: true - ENABLE_LEGACY_PROVIDER: true - ENABLE_PRELOADING: false - - name: Upload artifact uses: actions/upload-artifact@v3 with: @@ -100,19 +92,25 @@ jobs: path: ./apps/web/.next if-no-files-found: error - - name: Build Web (Desktop) - run: yarn nx build @affine/web - env: - API_SERVER_PROFILE: affine - ENABLE_DEBUG_PAGE: 1 - ENABLE_PLUGIN: true - ENABLE_ALL_PAGE_FILTER: true - ENABLE_LEGACY_PROVIDER: false - ENABLE_PRELOADING: false - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + build-web-desktop: + name: Build @affine/web (Desktop) + runs-on: ubuntu-latest + environment: development + env: + API_SERVER_PROFILE: affine + ENABLE_DEBUG_PAGE: 1 + ENABLE_PLUGIN: true + ENABLE_ALL_PAGE_FILTER: true + ENABLE_LEGACY_PROVIDER: false + ENABLE_PRELOADING: false + + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: ./.github/actions/setup-node - name: Export static resources - run: yarn workspace @affine/web export + run: yarn nx export @affine/web - name: Upload static resources artifact uses: actions/upload-artifact@v3 @@ -297,7 +295,7 @@ jobs: target: x86_64-pc-windows-msvc, test: true, } - needs: [build-web] + needs: [build-web-desktop] steps: - uses: actions/checkout@v3 - name: Setup Node.js diff --git a/nx.json b/nx.json index f97dbdee8b..f44bae11ec 100644 --- a/nx.json +++ b/nx.json @@ -29,7 +29,7 @@ "{projectRoot}/build", "{projectRoot}/out", "{projectRoot}/node_modules/.cache", - "apps/web/.next/cache", + "apps/web/.next", "packages/storybook/storybook-static", "packages/native/affine.*.node" ], @@ -83,6 +83,9 @@ } ] }, + "export": { + "dependsOn": ["build"] + }, "dev": { "dependsOn": ["^build"] },