diff --git a/.circleci/config.yml b/.circleci/config.yml index 2138ce63dcd..96f02920095 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -623,6 +623,19 @@ jobs: echo "-- no changes to docs files --" fi + release-packages-nightly: + docker: + - image: circleci/node:10 + steps: + - checkout + - run: + name: yarn install lerna + command: 'yarn install lerna' + no_output_timeout: 15m + - run: + name: prepare bumped versions + command: './scripts/circle-check-packages.sh' + workflows: version: 2 build-master: @@ -803,3 +816,7 @@ workflows: - postgres-integration-test - cache-server-test filters: *filter-not-release-or-master + - release-packages-nightly: + filters: *filter-not-release-or-master + requires: + - test-frontend diff --git a/scripts/circle-check-packages.sh b/scripts/circle-check-packages.sh new file mode 100755 index 00000000000..f16958f7527 --- /dev/null +++ b/scripts/circle-check-packages.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +#!/bin/bash + +# function exit_if_fail { +# command=$@ +# echo "Executing '$command'" +# eval $command +# rc=$? +# if [ $rc -ne 0 ]; then +# echo "'$command' returned $rc." +# exit $rc +# fi +# } + +# npm install lerna +# count=0 +# rc=$? + + +function parse_git_hash() { + git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/" +} + +#Get current version from lerna.json +PACKAGE_VERSION=`grep '"version"' lerna.json | cut -d '"' -f 4` +# Get short current commit's has +GIT_BRANCH=$(parse_git_hash) + +echo "Commit: ${GIT_BRANCH}" +echo "Current lerna.json version: ${PACKAGE_VERSION}" + +# count packages that changed +count=`lerna changed --loglevel silent | awk '{c++} END {print c}'` + +if [ -z $count ]; then + echo "No changes in packages, not publishing" +else + echo "Changes detected in ${count} packages" + echo "Releasing packages under ${PACKAGE_VERSION}-${GIT_BRANCH}" + lerna version ${PACKAGE_VERSION}-${GIT_BRANCH} --no-git-tag-version --no-push --force-publish -y + git status -s +fi +