Test Lerna Deploy
This commit is contained in:
+25
-11
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user