Revert "npm login" (#4299)

Reverts Stirling-Tools/Stirling-PDF#4296
This commit is contained in:
Anthony Stirling 2025-08-26 14:06:29 +01:00 committed by GitHub
parent 4aac124e76
commit 9b8091a630
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 5 additions and 49 deletions

View File

@ -270,8 +270,6 @@ jobs:
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/test:v2-frontend-${{ steps.commit-hashes.outputs.frontend_short }} tags: ${{ secrets.DOCKER_HUB_USERNAME }}/test:v2-frontend-${{ steps.commit-hashes.outputs.frontend_short }}
build-args: VERSION_TAG=v2-alpha build-args: VERSION_TAG=v2-alpha
platforms: linux/amd64 platforms: linux/amd64
secrets: |
npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Build and push V2 backend image - name: Build and push V2 backend image
if: steps.check-backend.outputs.exists == 'false' if: steps.check-backend.outputs.exists == 'false'

View File

@ -145,18 +145,12 @@ jobs:
node-version: '20' node-version: '20'
cache: 'npm' cache: 'npm'
cache-dependency-path: frontend/package-lock.json 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 - name: Install frontend dependencies
run: cd frontend && npm ci run: cd frontend && npm ci
- name: Build frontend - name: Build frontend
run: cd frontend && npm run build run: cd frontend && npm run build
- name: Run frontend tests - name: Run frontend tests
run: cd frontend && npm run test -- --run run: cd frontend && npm run test -- --run
- name: Clean up npmrc
if: always() && secrets.NPM_TOKEN != ''
run: rm -f ~/.npmrc
- name: Upload frontend build artifacts - name: Upload frontend build artifacts
uses: actions/upload-artifact@v4.6.2 uses: actions/upload-artifact@v4.6.2
with: with:

View File

@ -103,8 +103,6 @@ jobs:
${{ secrets.DOCKER_HUB_USERNAME }}/test:v2-frontend-latest ${{ secrets.DOCKER_HUB_USERNAME }}/test:v2-frontend-latest
build-args: VERSION_TAG=v2-alpha build-args: VERSION_TAG=v2-alpha
platforms: linux/amd64 platforms: linux/amd64
secrets: |
npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Build and push backend image - name: Build and push backend image
if: steps.check-backend.outputs.exists == 'false' if: steps.check-backend.outputs.exists == 'false'

View File

@ -51,10 +51,6 @@ jobs:
cache: 'npm' cache: 'npm'
cache-dependency-path: frontend/package-lock.json 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 - name: Install frontend dependencies
working-directory: frontend working-directory: frontend
run: npm ci run: npm ci
@ -62,10 +58,6 @@ jobs:
- name: Generate frontend license report - name: Generate frontend license report
working-directory: frontend working-directory: frontend
run: npm run generate-licenses run: npm run generate-licenses
- name: Clean up npmrc
if: always() && secrets.NPM_TOKEN != ''
run: rm -f ~/.npmrc
- name: Check for license warnings - name: Check for license warnings
run: | run: |

View File

@ -132,10 +132,6 @@ jobs:
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with: with:
cache: 'npm' 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 - name: Run TestDriver.ai
uses: testdriverai/action@f0d0f45fdd684db628baa843fe9313f3ca3a8aa8 #1.1.3 uses: testdriverai/action@f0d0f45fdd684db628baa843fe9313f3ca3a8aa8 #1.1.3
@ -152,10 +148,6 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FORCE_COLOR: "3" FORCE_COLOR: "3"
- name: Clean up npmrc
if: always() && secrets.NPM_TOKEN != ''
run: rm -f ~/.npmrc
cleanup: cleanup:
needs: [deploy, test] needs: [deploy, test]

View File

@ -6,32 +6,14 @@ WORKDIR /app
# Copy package files # Copy package files
COPY frontend/package*.json ./ COPY frontend/package*.json ./
# Install dependencies (uses .npmrc secret if available, otherwise anonymous) # Install dependencies
RUN --mount=type=secret,id=npmrc \ RUN npm ci
set -e && \
if [ -s /run/secrets/npmrc ]; then \
echo "Using authenticated npm registry" && \
echo "$(cat /run/secrets/npmrc)" > /root/.npmrc; \
else \
echo "Using anonymous npm registry (no token provided)"; \
fi && \
npm ci --loglevel=warn && \
rm -f /root/.npmrc
# Copy source code # Copy source code
COPY frontend . COPY frontend .
# Build the application (uses .npmrc secret if available, otherwise anonymous) # Build the application
RUN --mount=type=secret,id=npmrc \ RUN npm run build
set -e && \
if [ -s /run/secrets/npmrc ]; then \
echo "Using authenticated npm registry for build" && \
echo "$(cat /run/secrets/npmrc)" > /root/.npmrc; \
else \
echo "Using anonymous npm registry for build (no token provided)"; \
fi && \
npm run build && \
rm -f /root/.npmrc
# Production stage # Production stage
FROM nginx:alpine FROM nginx:alpine

View File

@ -71,4 +71,4 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/d
### `npm run build` fails to minify ### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)