stages: [test, publish] test: stage: test image: node:22-alpine script: [npm ci, npm run build, npm test] # Publishes to this project's package registry on a version tag (v1.2.3). # CI_JOB_TOKEN has write access to the project's own registry, so no stored # secret is needed. publish: stage: publish image: node:22-alpine rules: - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/ script: - npm ci - npm run build - echo "@extant2000:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc - echo "${CI_API_V4_URL#https:}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc - npm publish