add npm secret

This commit is contained in:
SennayT
2026-05-14 15:10:52 +03:00
parent 9dc494641f
commit 6ab8a0055e

View File

@@ -15,6 +15,17 @@ jobs:
outputs: outputs:
target: ${{ steps.dev.outputs.target || steps.staging.outputs.target }} target: ${{ steps.dev.outputs.target || steps.staging.outputs.target }}
steps: steps:
- name: Verify NPM Token
env:
# We map the secret here to check its existence
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "::error::The NPM_TOKEN secret is missing or empty. Please add it to your GitHub Secrets."
exit 1
fi
echo "NPM_TOKEN is present, proceeding with build..."
- name: 🛠️ Set Development Environment - name: 🛠️ Set Development Environment
id: dev id: dev
if: ${{github.ref_name == 'dev'}} if: ${{github.ref_name == 'dev'}}
@@ -36,6 +47,24 @@ jobs:
- name: 🐳 Build Docker Image - name: 🐳 Build Docker Image
run: docker build -t edr-${{needs.environment.outputs.target}} . run: docker build -t edr-${{needs.environment.outputs.target}} .
- name: 🐳 Build Docker Image
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
# Create the multi-line file
cat <<EOF > .npmrc_temp
@tria-plc:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
always-auth=true
EOF
# Build using the file
docker build --secret id=npmrc,src=.npmrc_temp -t edr-${{needs.environment.outputs.target}} .
# Shred/Remove the sensitive file
rm .npmrc_temp
deploy-service: deploy-service:
name: ${{ matrix.display_name }} name: ${{ matrix.display_name }}