From aabfc66ec5c3a7a9e33157849d2fe2725da1dbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Wed, 15 Oct 2025 10:15:17 +0200 Subject: [PATCH 1/2] Ignore .npmrc --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8f6e1daad6..91d78cafe7 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ yarn-error.log* # TypeScript *.tsbuildinfo +.npmrc \ No newline at end of file From f4b531a2da30adbce3621067eb338129359699b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Wed, 15 Oct 2025 10:33:34 +0200 Subject: [PATCH 2/2] Rename environment variable to set bun npm token --- .github/workflows/ci.yaml | 4 ++-- .github/workflows/deploy-preview.yaml | 2 +- .github/workflows/deploy-production.yaml | 2 +- .github/workflows/deploy-staging.yaml | 2 +- .github/workflows/publish.yaml | 4 +--- README.md | 2 +- bunfig.toml | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e8444a84f2..29027e9613 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,7 @@ on: branches: - main env: - NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }} + BUN_NPM_TOKEN: ${{ secrets.NPM_TOKEN_READONLY }} jobs: format: runs-on: ubuntu-latest @@ -41,7 +41,7 @@ jobs: name: Build (Open Source) timeout-minutes: 6 env: - NPM_TOKEN_READONLY: '' + BUN_NPM_TOKEN: '' steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/deploy-preview.yaml b/.github/workflows/deploy-preview.yaml index f3371166a6..5eafb3bcd3 100644 --- a/.github/workflows/deploy-preview.yaml +++ b/.github/workflows/deploy-preview.yaml @@ -5,7 +5,7 @@ on: branches: - main env: - NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }} + BUN_NPM_TOKEN: ${{ secrets.NPM_TOKEN_READONLY }} jobs: deploy-v2-vercel: name: Deploy v2 to Vercel (preview) diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index 9d5bb3abb9..98a91fd40e 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -4,7 +4,7 @@ on: branches: - main env: - NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }} + BUN_NPM_TOKEN: ${{ secrets.NPM_TOKEN_READONLY }} jobs: deploy-v2-vercel: name: Deploy v2 to Vercel (production) diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index ed2f290c72..a5660d249e 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -4,7 +4,7 @@ on: branches: - main env: - NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }} + BUN_NPM_TOKEN: ${{ secrets.NPM_TOKEN_READONLY }} jobs: deploy-v2-vercel: name: Deploy v2 to Vercel (staging) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 52bf232265..6a57c340cc 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,7 +6,7 @@ on: - main env: - NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }} + BUN_NPM_TOKEN: ${{ secrets.NPM_TOKEN }} concurrency: ${{ github.workflow }}-${{ github.ref }} @@ -22,8 +22,6 @@ jobs: fetch-depth: 0 - name: Setup Bun uses: ./.github/composite/setup-bun - - name: Setup npmrc - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc - name: Install dependencies run: bun install --frozen-lockfile env: diff --git a/README.md b/README.md index 3f8ca2a38a..c4a85b76cd 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ If you are GitBook staff, you'll need our NPM token in your local environment. ``` .env.local -NPM_TOKEN_READONLY=xxx +BUN_NPM_TOKEN=xxx ``` and then reinstall dependencies. diff --git a/bunfig.toml b/bunfig.toml index 1716967668..28931d6390 100644 --- a/bunfig.toml +++ b/bunfig.toml @@ -1,2 +1,2 @@ [install.scopes] -"gitbook" = { token = "$NPM_TOKEN_READONLY", url = "https://registry.npmjs.org" } +"gitbook" = { token = "$BUN_NPM_TOKEN", url = "https://registry.npmjs.org" }