Test Lerna Deploy
This commit is contained in:
+21
-7
@@ -22,21 +22,35 @@ before_script:
|
|||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
# Run tests
|
||||||
- npm run test
|
- npm run test
|
||||||
|
# Ensure no circular dependencies
|
||||||
- npm run madge
|
- npm run madge
|
||||||
|
|
||||||
publish:development:
|
publish:development:
|
||||||
|
stage: publish
|
||||||
# Configure what tag to use for this publication.
|
# Configure what tag to use for this publication.
|
||||||
variables:
|
variables:
|
||||||
NPM_TAG: 'development'
|
NPM_TAG: 'development'
|
||||||
|
GITLAB_USER_EMAIL: 'ci@stack.xo.cash'
|
||||||
|
GITLAB_USER_NAME: 'CI - Stack'
|
||||||
script:
|
script:
|
||||||
# set our npm token and then use lerna to publish all packages that are not marked as "private".
|
# Setup git config
|
||||||
- npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
|
- git config --global user.email "${GITLAB_USER_EMAIL}"
|
||||||
# Publish Primitives
|
- git config --global user.name "${GITLAB_USER_NAME}"
|
||||||
# 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.
|
# Configure git to push with CI token
|
||||||
- (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})
|
- git remote set-url origin "https://oauth2:${CI_JOB_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git"
|
||||||
- (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 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:
|
only:
|
||||||
- development
|
- development
|
||||||
|
|
||||||
|
|||||||
+18
-2
@@ -1,5 +1,21 @@
|
|||||||
{
|
{
|
||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user