From 5f70232d6dd207395bf29ca4e7f7e81b2886cb65 Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Thu, 18 Feb 2021 11:10:09 -0800 Subject: [PATCH] monorepo: Add manual version bump and publish config/scripts --- .npmrc | 1 + lerna.json | 7 ++++++- package.json | 4 ++++ scripts/push-version-bump.sh | 13 +++++++++++++ scripts/version-bump.sh | 13 +++++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .npmrc create mode 100755 scripts/push-version-bump.sh create mode 100755 scripts/version-bump.sh diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..83883c9627 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@mm-snap:registry="https://npm.pkg.github.com" diff --git a/lerna.json b/lerna.json index d69c19658f..c0f708ec68 100644 --- a/lerna.json +++ b/lerna.json @@ -1,8 +1,13 @@ { "version": "0.0.1", - "npmClient": "yarn", + "command": { + "publish": { + "registry": "https://npm.pkg.github.com" + } + }, "packages": [ "packages/*" ], + "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index e719bcebad..c262b0750d 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ ], "scripts": { "link-packages": "./scripts/link-packages.sh", + "version-bump": "./scripts/version-bump.sh", + "push-version-bump": "./scripts/push-version-bump.sh", + "release": "yarn version-bump && yarn push-version-bump", + "publish": "lerna publish from-package", "prepare": "lerna run prepare" }, "devDependencies": {} diff --git a/scripts/push-version-bump.sh b/scripts/push-version-bump.sh new file mode 100755 index 0000000000..2a6e050097 --- /dev/null +++ b/scripts/push-version-bump.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +MM_SNAP_VERSION=$(node -p 'require("./lerna.json").version') + +git checkout -b "${MM_SNAP_VERSION}" +git commit -m "${MM_SNAP_VERSION}" || true +git push -u origin "${MM_SNAP_VERSION}" + +unset MM_SNAP_VERSION diff --git a/scripts/version-bump.sh b/scripts/version-bump.sh new file mode 100755 index 0000000000..2f951921e5 --- /dev/null +++ b/scripts/version-bump.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +if [ -z "${1:-}" ] +then + echo "Error: Missing required positional argument: patch|minor|major" + exit 1 +fi + +lerna version "$1" --no-git-tag-version