Skip to content

publish npm packages #2832

publish npm packages

publish npm packages #2832

name: publish npm packages
env:
NX_CLOUD_ACCESS_TOKEN: ${{ vars.NX_CLOUD_ACCESS_TOKEN }}
on:
workflow_dispatch:
# trigger this workflow when the CI workflow is completed
workflow_run:
workflows: ["Continuous Integration"]
branches: [main]
types:
- completed
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js 22
uses: actions/setup-node@v3
with:
node-version: 22
cache: "pnpm"
# Conditional steps based on the check
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- run: pnpm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install Doppler CLI for env variables
uses: dopplerhq/cli-action@v2
- name: Build
run: doppler run -- pnpm build
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PRODUCTION_ENV_TOKEN }}
- name: Publish packages
run: pnpm publish -r --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}