Firstly, this is based on the short post here.
You need to create an .npmrc file on the fly via your github actions .yml script.
Separate steps and echo your environment variable from NPM, set in Github (at Musicfox NPM_AUTH_TOKEN), and pre-write a fresh .npmrc.
⚠️ Steps are not in order!⚠️
See this sample:
---
name: "Chromatic"
on: [push]
jobs:
build-test-publish-components:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0 # required for git history retrieval
scope: '@musicfox'
- name: Setup NPMrc
run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_AUTH_TOKEN}}" > .npmrc
- name: Install source
run: |
npm install
- name: Build source
run: |
npm build
- name: Run and publish chromatic tests
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
...