From 6673451c81d101bba0c208b9c3cde66bd6b65fd3 Mon Sep 17 00:00:00 2001 From: Alex H Date: Thu, 7 Mar 2024 17:59:14 +0100 Subject: [PATCH] ci: Cache for bump --- .github/workflows/bump-version.yml | 6 +++--- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yml | 25 ++++++++++++++++++++----- tools/scripts/prepare-for-angular.mjs | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 7c7f717..cafe056 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -29,7 +29,7 @@ jobs: with: path: | .nx - key: ${{ runner.os }}-nx-master" + key: ${{ runner.os }}-nx-master - name: Test and build run: npx nx affected -t test build --parallel=3 --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source' - name: Upload test coverage badge @@ -76,7 +76,7 @@ jobs: with: path: | .nx - key: ${{ runner.os }}-nx-master" + key: ${{ runner.os }}-nx-master - run: git branch --track main origin/master - run: npm run typeorm migration:run - run: npm run seed:run @@ -109,7 +109,7 @@ jobs: run: | git config user.name 'Alex H' git config user.email 'klerick666@gmail.com' - npx nx release --skip-publish --dry-run + npx nx release --skip-publish shell: bash env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edd8177..a3c4103 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: with: path: | .nx - key: ${{ runner.os }}-nx-${{ steps.branch-names.outputs.current_branch }}" + key: ${{ runner.os }}-nx-${{ steps.branch-names.outputs.current_branch }} - run: git branch --track main origin/master - name: Test and build run: npx nx affected -t test build --parallel=3 --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source' @@ -74,7 +74,7 @@ jobs: with: path: | .nx - key: ${{ runner.os }}-nx-${{ steps.branch-names.outputs.current_branch }}" + key: ${{ runner.os }}-nx-${{ steps.branch-names.outputs.current_branch }} - run: git branch --track main origin/master - run: npm run typeorm migration:run - run: npm run seed:run diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 77a7339..b3a2020 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,11 @@ name: Publish on: - workflow_run: - workflows: [ "Create Releases" ] - types: - - completed +# workflow_run: +# workflows: [ "Create Releases" ] +# types: +# - completed + workflow_dispatch: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} NPM_CONFIG_PROVENANCE: true @@ -25,10 +26,24 @@ jobs: fetch-depth: 0 - name: Npm install uses: ./.github/actions + - name: Restore cached .nx + id: cache-nx-restore + uses: actions/cache/restore@v4 + with: + path: | + .nx + key: ${{ runner.os }}-nx-master - run: npx nx affected -t build --parallel=3 --exclude='json-api-front,json-api-server,json-api-server-e2e,shared-utils,json-shared-type,database' - name: Publish packages - run: npx nx release publish + run: npx nx release publish --dry-run shell: bash env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true + - name: Save cached .nx + id: cache-dependencies-save + uses: actions/cache/save@v4 + with: + path: | + .nx + key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }} diff --git a/tools/scripts/prepare-for-angular.mjs b/tools/scripts/prepare-for-angular.mjs index 651af41..fe8850d 100644 --- a/tools/scripts/prepare-for-angular.mjs +++ b/tools/scripts/prepare-for-angular.mjs @@ -14,8 +14,8 @@ writeFileSync( promisify(exec)( `nx run json-api-nestjs-sdk:compile-for-angular` ).then(r => { - console.log(r) writeFileSync(LIB_ANGULAR_MODULE_PATH, readFileSync(ANGULAR_MODULE_PATH)) + console.log(readFileSync(LIB_ANGULAR_MODULE_PATH)); }).finally(() => { unlinkSync(TEMP_FILE_PATH) })