Skip to content

Commit

Permalink
dx: add script to release to git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgepigdaniel committed Dec 20, 2019
1 parent 2c6bc51 commit e3da9b5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"format": "prettier --write \"**/*.{js,json,md}\"",
"lint": "eslint .",
"release": "lerna publish --conventional-commits && conventional-github-releaser --preset angular",
"release-to-git": "./scripts/git-release.sh",
"test": "jest"
},
"devDependencies": {
Expand Down Expand Up @@ -47,6 +48,7 @@
"eslint-plugin-react": "^7.17.0",
"jest": "^24.9.0",
"lerna": "^3.19.0",
"npm-publish-git": "git://github.com/hedgepigdaniel/npm-publish-git.git",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
Expand Down
22 changes: 22 additions & 0 deletions scripts/git-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -e

BRANCH=$(git rev-parse --abbrev-ref HEAD)

yarn run lerna version --conventional-prerelease --preid from-git --no-git-tag-version --no-push --allow-branch $BRANCH --yes
git add .
git commit -m "Publish to git"

for DIR in $(yarn run -s lerna changed --parseable); do
(
VERSION=$(cat "${DIR}/package.json" | jq -r '.version')
NAME=$(cat "${DIR}/package.json" | jq -r '.name')

(
cd "$DIR"
yarn run prepublishOnly
)
yarn run npm-publish-git --dir "$DIR" --tag "${NAME}/${BRANCH}/${VERSION}"
)
done
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6900,6 +6900,10 @@ npm-pick-manifest@^3.0.0:
npm-package-arg "^6.0.0"
semver "^5.4.1"

"npm-publish-git@git://github.com/hedgepigdaniel/npm-publish-git.git":
version "0.0.10"
resolved "git://github.com/hedgepigdaniel/npm-publish-git.git#c6ebdd98043ad0b014e537d95a00004ec0951486"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
Expand Down

0 comments on commit e3da9b5

Please sign in to comment.