From 0ee2ecc1e941852934c8ffdba67c9424c67ee7aa Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 28 Nov 2023 06:59:50 +0000 Subject: [PATCH] ci: always perform fresh build in deployment job (#5066) --- .github/workflows/deploy.yml | 2 +- .github/workflows/nightly-build.yml | 5 +++-- .github/workflows/release-desktop-app.yml | 1 + packages/frontend/electron/scripts/generate-assets.ts | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e12cf1629f..f956b50864 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -41,7 +41,7 @@ jobs: - name: Build Plugins run: yarn run build:plugins - name: Build Core - run: yarn nx build @affine/core + run: yarn nx build @affine/core --skip-nx-cache env: R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 6a82abe5bf..84dce785b9 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -65,14 +65,15 @@ jobs: - name: Replace Version run: ./scripts/set-version.sh ${{ needs.set-build-version.outputs.version }} - name: generate-assets - working-directory: packages/frontend/electron - run: yarn generate-assets + run: yarn workspace @affine/electron generate-assets env: 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 }} RELEASE_VERSION: ${{ needs.set-build-version.outputs.version }} + SKIP_PLUGIN_BUILD: 'true' + SKIP_NX_CACHE: 'true' - name: Upload core artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/release-desktop-app.yml b/.github/workflows/release-desktop-app.yml index 33abe80447..08723c41fa 100644 --- a/.github/workflows/release-desktop-app.yml +++ b/.github/workflows/release-desktop-app.yml @@ -67,6 +67,7 @@ jobs: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} RELEASE_VERSION: ${{ github.event.inputs.version || steps.get-canary-version.outputs.RELEASE_VERSION }} SKIP_PLUGIN_BUILD: 'true' + SKIP_NX_CACHE: 'true' - name: Upload core artifact uses: actions/upload-artifact@v3 diff --git a/packages/frontend/electron/scripts/generate-assets.ts b/packages/frontend/electron/scripts/generate-assets.ts index 20c9d38f5c..0284274d21 100755 --- a/packages/frontend/electron/scripts/generate-assets.ts +++ b/packages/frontend/electron/scripts/generate-assets.ts @@ -39,6 +39,9 @@ process.env.DISTRIBUTION = 'desktop'; const cwd = repoRootDir; +const { SKIP_NX_CACHE } = process.env; +const nxFlag = SKIP_NX_CACHE ? '--skip-nx-cache' : ''; + if (!process.env.SKIP_PLUGIN_BUILD) { spawnSync('yarn', ['build:plugins'], { stdio: 'inherit', @@ -49,7 +52,7 @@ if (!process.env.SKIP_PLUGIN_BUILD) { // step 1: build web dist if (!process.env.SKIP_WEB_BUILD) { - spawnSync('yarn', ['nx', 'build', '@affine/core'], { + spawnSync('yarn', ['nx', 'build', '@affine/core', nxFlag], { stdio: 'inherit', env: process.env, cwd,