From b0395a5cf1e5bbd1f3dcdd64de54d2333cdf036b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= <57442769+gjedlicska@users.noreply.github.com> Date: Thu, 14 Apr 2022 20:15:27 +0200 Subject: [PATCH] CI/lernaPublish (#700) * ci(circle ci): test lerna publish with git tag * ci(circle ci): checkout the repo first * ci(circle ci): auto set upstream to the current branch * ci(circle ci): actually push the branch * ci(husky): ignore husky hooks if running in CI * ci(circle ci): install root level npm packages in npm publish step * ci(circle ci): install gh cli for npm publish * ci(circle ci): fix orb reference * ci(circle): fix gh pr create text values * ci(circle): fix gh pr create args again * ci(circle): gave up on the whole lerna push updates to the repo stuff * ci(circle): fix dist tag next * ci(circle): turns out you do need husky for this to work * ci(circle): revert to prod tagging scheme * ci(circle): publish with default dist tag from lerna --- .circleci/config.yml | 36 ++++++++++++++---------------------- .husky/pre-commit | 2 ++ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b53912fb..a56ad3b31 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,11 @@ workflows: test-build: jobs: - - test-server + - test-server: + filters: + tags: + # run tests for all tags + only: /.*/ - get-version: filters: &filters-build tags: @@ -16,7 +20,6 @@ workflows: branches: only: - main - - docker-build-and-publish-server: filters: *filters-build context: &docker-hub-context @@ -83,16 +86,6 @@ workflows: - get-version jobs: - lint: - docker: &docker-image - - image: cimg/python:3.9-node - steps: - - checkout - - run: npm ci - - run: npx lerna bootstrap - - run: pip install pre-commit - - run: pre-commit run --all-files - get-version: docker: - image: cimg/python:3.9 @@ -151,7 +144,8 @@ jobs: destination: package/server/coverage docker-build-and-publish: &docker-job - docker: *docker-image + docker: &docker-image + - image: cimg/python:3.9-node working_directory: *work-dir steps: - checkout @@ -203,7 +197,11 @@ jobs: - attach_workspace: at: /tmp/ci/workspace - run: cat workspace/env-vars >> $BASH_ENV - - run: npx lerna bootstrap + - run: + name: restore packages + command: | + npm i + npx lerna bootstrap # this has to be after lerna bootstrap # otherwise the auth workflow of lerna is borked... - run: @@ -215,15 +213,9 @@ jobs: - run: name: try login to npm command: npm whoami - - add_ssh_keys: - fingerprints: - - 'e4:47:eb:29:a7:0b:56:a7:9b:d3:a9:e0:05:5c:13:e3' - run: - name: setup git user - command: | - git config --global user.email "devops+circleci@speckle.systems" - git config --global user.name "CI" - - run: npx lerna publish $IMAGE_VERSION_TAG -y + name: publish to npm + command: npx lerna publish $IMAGE_VERSION_TAG -y --no-git-tag-version --no-push publish-helm-chart: docker: *docker-image diff --git a/.husky/pre-commit b/.husky/pre-commit index 36af21989..4002971e7 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,6 @@ #!/bin/sh +[ -n "$CI" ] && exit 0 + . "$(dirname "$0")/_/husky.sh" npx lint-staged