Skip to content

Publish Package to NPM #117

Publish Package to NPM

Publish Package to NPM #117

name: Publish Package to NPM
on:
workflow_dispatch:
release:
types:
- published
jobs:
deploy-to-npm:
runs-on: ubuntu-latest
environment: CD
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Setup Cognite CICD
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install NPM dependencies
working-directory: viewer
run: |
sudo apt update
sudo apt install libxi-dev libgl-dev libglx-dev
yarn install --immutable
- name: Build production version
working-directory: viewer
run: yarn run build:prod
- name: Publish to NPM
working-directory: viewer
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}