Skip to content

fix: npm authentication in CI #177

fix: npm authentication in CI

fix: npm authentication in CI #177

name: ss-search CI
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Remove package versions from package-lock.json for caching
run: |
jq 'del(.version, .packages[""].version)' package-lock.json > package-lock.temp.json
mv package-lock.temp.json package-lock.json
- name: Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: |
./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Install NPM packages
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Lint files
run: npm run lint:all
- name: Check formatting
run: npm run format:check:ci
- name: Run tests
run: npm run test:all
- name: Build apps
run: npm run build:all -- --prod
- name: Check exports
run: npm run exports:check
- name: Run benchmark
run: npm run benchmark
- name: Configure Git identity (required to create NX git commit and tags)
if: github.ref == 'refs/heads/master'
run: |
git config --global user.email "[email protected]"
git config --global user.name "NX CI Bot"
- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Release + Publish package
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: npx nx release -y
- name: Deploy to netlify
if: github.ref == 'refs/heads/master'
run: npm run netlify:deploy
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}