Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Use NODE_AUTH_TOKEN instead of old unmaintained npm-cli-login #36

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'

- name: Log into Verdaccio
if: ${{ inputs.enterprise }}
shell: bash
run: |
npm install -g npm-cli-login
npm-cli-login -u "${{ secrets.NPM_USER }}" -p "${{ secrets.NPM_PASS }}" -e [email protected] -r https://registrynpm.storefrontcloud.io
registry-url: 'https://registrynpm.storefrontcloud.io'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only problem here is that this needs a NODE_AUTH_TOKEN env var present like:

$ echo "NODE_AUTH_TOKEN=$(${{ secrets.NPM_USER }}:${{ secrets.NPM_PASS }} | base64)" >> $GITHUB_ENV

I don't want to base64 the secrets because that way GitHub actions won't protect them against being leaked. It'd be much better to have a convention where you need to pass NODE_AUTH_TOKEN as a secret to this workflow.

The problem is that now we have a convention of having NPM_PASS and NPM_USER separately, so I'd need to write some compat input to the action that selectively uses one or the other.

Or just make a new branch for the newer CI


- name: Install dependencies
shell: bash
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ on:
required: false
default: "['16', '18']"

env:
HUSKY: 0

jobs:
scanning:
name: GitGuardian scan
Expand Down Expand Up @@ -64,13 +67,15 @@ jobs:
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
to_envs() { jq -r "to_entries[] | \"\(.key)<<$EOF\n\(.value)\n$EOF\n\""; }
echo "$SECRETS_CONTEXT" | to_envs >> $GITHUB_ENV

- name: Checkout code 🛎️
uses: actions/checkout@v3

- name: Setup node 🏗️
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
registry-url: 'https://registrynpm.storefrontcloud.io'

- name: Get cache 🗄️
id: cache
Expand All @@ -79,17 +84,11 @@ jobs:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Log into Verdaccio
if: ${{ inputs.enterprise }}
shell: bash
run: |
npm install -g npm-cli-login
npm-cli-login -u "${{ secrets.NPM_USER }}" -p "${{ secrets.NPM_PASS }}" -e [email protected] -r https://registrynpm.storefrontcloud.io

- name: Install dependencies (OS)
if: ${{ !steps.cache.outputs.cache-hit }}
shell: bash
run: HUSKY=0 yarn --frozen-lockfile
run: yarn --frozen-lockfile

- name: Detect circular dependencies 🔄
uses: vuestorefront/engineering-toolkit/github-actions/circular-dependencies@main
Expand Down