diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d549e3c34..509bf37e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -143,21 +143,20 @@ jobs: uses: actions/setup-node@v4.1.0 with: node-version: '20' - registry-url: 'https://registry.npmjs.org' cache: 'npm' cache-dependency-path: frontend/package-lock.json + - name: Configure npm with token (if available) + if: secrets.NPM_TOKEN != '' + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: Install frontend dependencies run: cd frontend && npm ci - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Build frontend run: cd frontend && npm run build - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Run frontend tests run: cd frontend && npm run test -- --run - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Clean up npmrc + if: always() && secrets.NPM_TOKEN != '' + run: rm -f ~/.npmrc - name: Upload frontend build artifacts uses: actions/upload-artifact@v4.6.2 with: diff --git a/.github/workflows/frontend-licenses-update.yml b/.github/workflows/frontend-licenses-update.yml index 54e423c58..ac2013e2d 100644 --- a/.github/workflows/frontend-licenses-update.yml +++ b/.github/workflows/frontend-licenses-update.yml @@ -48,21 +48,24 @@ jobs: uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 with: node-version: '18' - registry-url: 'https://registry.npmjs.org' cache: 'npm' cache-dependency-path: frontend/package-lock.json + - name: Configure npm with token (if available) + if: secrets.NPM_TOKEN != '' + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + - name: Install frontend dependencies working-directory: frontend run: npm ci - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Generate frontend license report working-directory: frontend run: npm run generate-licenses - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Clean up npmrc + if: always() && secrets.NPM_TOKEN != '' + run: rm -f ~/.npmrc - name: Check for license warnings run: | diff --git a/.github/workflows/testdriver.yml b/.github/workflows/testdriver.yml index 68f487141..67d248d46 100644 --- a/.github/workflows/testdriver.yml +++ b/.github/workflows/testdriver.yml @@ -131,8 +131,11 @@ jobs: - name: Set up Node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - registry-url: 'https://registry.npmjs.org' cache: 'npm' + + - name: Configure npm with token (if available) + if: secrets.NPM_TOKEN != '' + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: Run TestDriver.ai uses: testdriverai/action@f0d0f45fdd684db628baa843fe9313f3ca3a8aa8 #1.1.3 @@ -148,8 +151,11 @@ jobs: 1. /run testing/testdriver/test.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} FORCE_COLOR: "3" + + - name: Clean up npmrc + if: always() && secrets.NPM_TOKEN != '' + run: rm -f ~/.npmrc cleanup: needs: [deploy, test]