mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-27 06:39:24 +00:00
npm login (#4296)
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: a <a>
This commit is contained in:
parent
6d7f76353e
commit
4aac124e76
2
.github/workflows/PR-Auto-Deploy-V2.yml
vendored
2
.github/workflows/PR-Auto-Deploy-V2.yml
vendored
@ -270,6 +270,8 @@ 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'
|
||||||
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -145,12 +145,18 @@ 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:
|
||||||
|
2
.github/workflows/deploy-on-v2-commit.yml
vendored
2
.github/workflows/deploy-on-v2-commit.yml
vendored
@ -103,6 +103,8 @@ 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'
|
||||||
|
@ -51,6 +51,10 @@ 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
|
||||||
@ -59,6 +63,10 @@ jobs:
|
|||||||
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: |
|
||||||
if [ -f "frontend/src/assets/license-warnings.json" ]; then
|
if [ -f "frontend/src/assets/license-warnings.json" ]; then
|
||||||
|
8
.github/workflows/testdriver.yml
vendored
8
.github/workflows/testdriver.yml
vendored
@ -133,6 +133,10 @@ jobs:
|
|||||||
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
|
||||||
with:
|
with:
|
||||||
@ -149,6 +153,10 @@ jobs:
|
|||||||
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]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -6,14 +6,32 @@ WORKDIR /app
|
|||||||
# Copy package files
|
# Copy package files
|
||||||
COPY frontend/package*.json ./
|
COPY frontend/package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies (uses .npmrc secret if available, otherwise anonymous)
|
||||||
RUN npm ci
|
RUN --mount=type=secret,id=npmrc \
|
||||||
|
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
|
# Build the application (uses .npmrc secret if available, otherwise anonymous)
|
||||||
RUN npm run build
|
RUN --mount=type=secret,id=npmrc \
|
||||||
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user