Setup NPM publishing config

This commit is contained in:
Jim Hamill
2025-01-11 22:40:15 +00:00
parent c1fce2b67d
commit fc90753157
7 changed files with 39 additions and 7 deletions
+26 -3
View File
@@ -1,4 +1,4 @@
image: node:20
image: node:22
stages:
- publish
@@ -18,6 +18,29 @@ before_script:
- npm install
- npm run build
.publish_to_npm:
# Configure which stage in the pipeline this part should be run in.
stage: publish
script:
- npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
- npx lerna publish from-package --no-private --yes --registry https://registry.npmjs.org/ --tag ${NPM_TAG}
publish:development:
# Configure what tag to use for this publication.
variables:
NPM_TAG: 'development'
script:
# add the NPM_TAG to the version field in the package file during this script
- sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" packages/primitives/package.json
only:
- development
# Use the common template to publish the library.
extends: .publish_to_npm
# Publish the documentation to GitLab Pages (for now).
pages:
stage: publish
@@ -27,5 +50,5 @@ pages:
artifacts:
paths:
- public
# only:
# - main
only:
- development