diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e54e89b31..fc92793d6 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -15,6 +15,17 @@ jobs: outputs: target: ${{ steps.dev.outputs.target || steps.staging.outputs.target }} 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 id: dev if: ${{github.ref_name == 'dev'}} @@ -36,6 +47,24 @@ jobs: - name: 🐳 Build Docker Image 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 < .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: name: ${{ matrix.display_name }}