diff --git a/.github/workflows/algolia-prod.yml b/.github/workflows/algolia-prod.yml index 498ab7688f..6aa1b8911d 100644 --- a/.github/workflows/algolia-prod.yml +++ b/.github/workflows/algolia-prod.yml @@ -22,7 +22,7 @@ jobs: cache: 'npm' node-version-file: 'package.json' - - run: npm i + - run: npm ci - run: npm run prebuild -- --get-real-file-changed-metadata --build-algolia-index - run: npm run algolia env: diff --git a/.github/workflows/build-pr-preview.yml b/.github/workflows/build-pr-preview.yml index 9ecb1690a2..20a86170be 100644 --- a/.github/workflows/build-pr-preview.yml +++ b/.github/workflows/build-pr-preview.yml @@ -2,6 +2,10 @@ name: Build Preview run-name: 'Build Preview for "${{ github.event.pull_request.title }}" (#${{ github.event.pull_request.number }})' on: + # 1: Change this to `pull_request` to see changes while testing this file in a PR. + # 2: This is because `pull_request_target` only works from the context of the base branch + # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request_target + # 3: Change this back to `pull_request_target` before merge for security reasons pull_request_target: types: [opened, synchronize] # Hello Security 👋, we are checking to make sure forked repo PR changed paths are only in content/** inside the job security-check. @@ -105,20 +109,11 @@ jobs: cache: 'npm' node-version-file: 'package.json' - - name: Generate cache manifest - run: git ls-files -z -- '*.js' '*.mjs' '*.ts' '*.tsx' '*.mdx' '*.json' | xargs -0 git hash-object > cache-key.txt - - - name: Use cache + - name: Cache Next.js build uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: - path: | - ~/.npm - ${{ github.workspace }}/.next/cache - # Generate a new cache whenever packages or source files change. - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('cache-key.txt') }} - # If source files changed but packages didn't, rebuild from a prior cache. - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + path: ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-build-${{ hashFiles('package-lock.json', 'next.config.js') }} - name: Install Vercel CLI run: npm i --global vercel@latest @@ -187,17 +182,6 @@ jobs: with: repository: hashicorp/dev-portal path: ./unified-docs-frontend-preview - - name: Use cache - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 - with: - path: | - ~/.npm - ${{ github.workspace }}/unified-docs-frontend-preview/.next/cache - # Generate a new cache whenever packages or source files change. - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mdx') }} - # If source files changed but packages didn't, rebuild from a prior cache. - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- - name: Setup Node.js uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 @@ -206,6 +190,12 @@ jobs: cache-dependency-path: 'unified-docs-frontend-preview/package-lock.json' node-version-file: 'unified-docs-frontend-preview/package.json' + - name: Cache Next.js build + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 + with: + path: ${{ github.workspace }}/unified-docs-frontend-preview/.next/cache + key: ${{ runner.os }}-nextjs-build-devportal-${{ hashFiles('unified-docs-frontend-preview/package-lock.json', 'unified-docs-frontend-preview/next.config.js') }} + - name: Setup Vercel CLI run: npm i --global vercel@latest diff --git a/.github/workflows/copy-cloud-docs-for-tfe.yml b/.github/workflows/copy-cloud-docs-for-tfe.yml index 44959479f7..15dbcadb6a 100644 --- a/.github/workflows/copy-cloud-docs-for-tfe.yml +++ b/.github/workflows/copy-cloud-docs-for-tfe.yml @@ -52,7 +52,7 @@ jobs: - name: Generate version-metadata for workflow working-directory: '${{github.workspace}}/new-docs-pr' run: | - npm i + npm ci npm run prebuild -- --only-build-version-metadata - name: Create the new TFE version folder for RELEASE PR diff --git a/.github/workflows/deploy-udr.yml b/.github/workflows/deploy-udr.yml index f5ebdf0a0b..39970f7999 100644 --- a/.github/workflows/deploy-udr.yml +++ b/.github/workflows/deploy-udr.yml @@ -27,17 +27,11 @@ jobs: cache: 'npm' node-version-file: 'package.json' - - name: Use cache + - name: Cache Next.js build uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: - path: | - ~/.npm - ${{ github.workspace }}/.next/cache - # Generate a new cache whenever packages or source files change. - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.mjs', '**/*.ts', '**/*.tsx', '**/*.mdx') }} - # If source files changed but packages didn't, rebuild from a prior cache. - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + path: ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-build-${{ hashFiles('package-lock.json', 'next.config.js') }} - name: Install Vercel CLI run: npm install --global vercel@latest diff --git a/.github/workflows/sync-docs-for-tfe.yml b/.github/workflows/sync-docs-for-tfe.yml index 7a1f932055..ee8e29c24e 100644 --- a/.github/workflows/sync-docs-for-tfe.yml +++ b/.github/workflows/sync-docs-for-tfe.yml @@ -83,7 +83,7 @@ jobs: - name: Generate version-metadata for workflow working-directory: '${{github.workspace}}/new-docs' run: | - npm i + npm ci npm run prebuild -- --only-build-version-metadata - name: Checkout HCPTF-diff for new docs version DIFF PR diff --git a/.github/workflows/test-and-lint.yml b/.github/workflows/test-and-lint.yml index a6b7ac5252..1141c4e253 100644 --- a/.github/workflows/test-and-lint.yml +++ b/.github/workflows/test-and-lint.yml @@ -28,7 +28,7 @@ jobs: cache: 'npm' node-version-file: 'package.json' - - run: npm i + - run: npm ci - run: npm run test lint: @@ -46,7 +46,7 @@ jobs: node-version-file: 'package.json' - name: Install Dependencies - run: npm i + run: npm ci - name: Run lint check run: npm run lint diff --git a/scripts/prebuild/prebuild-arm-linux-binary.gz b/scripts/prebuild/prebuild-arm-linux-binary.gz index 4725cfbd14..0498d0e265 100755 Binary files a/scripts/prebuild/prebuild-arm-linux-binary.gz and b/scripts/prebuild/prebuild-arm-linux-binary.gz differ diff --git a/scripts/prebuild/prebuild-arm-mac-binary.gz b/scripts/prebuild/prebuild-arm-mac-binary.gz index f36980722d..853d3a6cdd 100755 Binary files a/scripts/prebuild/prebuild-arm-mac-binary.gz and b/scripts/prebuild/prebuild-arm-mac-binary.gz differ diff --git a/scripts/prebuild/prebuild-x64-linux-binary.gz b/scripts/prebuild/prebuild-x64-linux-binary.gz index 28900eb50f..2f0a61a034 100755 Binary files a/scripts/prebuild/prebuild-x64-linux-binary.gz and b/scripts/prebuild/prebuild-x64-linux-binary.gz differ diff --git a/scripts/utils/batch-promises.mjs b/scripts/utils/batch-promises.mjs index b2f4cb15ac..408d0b1dde 100644 --- a/scripts/utils/batch-promises.mjs +++ b/scripts/utils/batch-promises.mjs @@ -20,8 +20,8 @@ export async function batchPromises( batchName, arrayToBatch, asyncMapFn, - { batchSize = 16, loggingEnabled = true } = { - batchSize: 16, + { batchSize = 64, loggingEnabled = true } = { + batchSize: 64, loggingEnabled: true, }, ) {