Test Lerna Deploy

This commit is contained in:
Jim Hamill
2025-02-16 03:55:24 +00:00
parent 154e2d4978
commit 7b08f20bd0
2 changed files with 43 additions and 13 deletions
+25 -11
View File
@@ -20,23 +20,37 @@ before_script:
- npm run build
test:
stage: test
script:
- npm run test
- npm run madge
stage: test
script:
# Run tests
- npm run test
# Ensure no circular dependencies
- npm run madge
publish:development:
stage: publish
# Configure what tag to use for this publication.
variables:
NPM_TAG: 'development'
GITLAB_USER_EMAIL: 'ci@stack.xo.cash'
GITLAB_USER_NAME: 'CI - Stack'
script:
# set our npm token and then use lerna to publish all packages that are not marked as "private".
- npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
# Publish Primitives
# NOTE: The "sed" command will append the JOB_ID version to the current package.json.
# TODO: Simplify this in future or use Lerna's "publish" command.
- (cd ./packages/primitives && sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" package.json && npm publish --access public --tag ${NPM_TAG})
- (cd ./packages/stack && sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" package.json && npm publish --access public --tag ${NPM_TAG})
# Setup git config
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
# Configure git to push with CI token
- git remote set-url origin "https://oauth2:${CI_JOB_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git"
# Setup npm authentication
- |
echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=https://gitlab.com/api/v4/packages/npm/" > .npmrc
echo "//gitlab.com/api/v4/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
echo "//gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
# Skip git checks when versioning and publishing
- npx lerna version patch --yes --force-publish --no-git-checks
- npx lerna publish from-git --yes --no-git-checks
only:
- development
+18 -2
View File
@@ -1,5 +1,21 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"packages": ["packages/*"],
"version": "0.0.1"
"version": "0.0.1",
"packages": [
"packages/*"
],
"npmClient": "npm",
"command": {
"version": {
"allowBranch": [
"development"
],
"exact": true,
"message": "chore: increment patch version to %v"
},
"publish": {
"registry": "https://gitlab.com/api/v4/packages/npm/",
"exact": true
}
}
}