Skip to content

Commit

Permalink
feat: Sync version with cli
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Apr 22, 2024
1 parent 207dec4 commit 8cf9445
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions script/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,18 @@

set -e

VERSION=$1
if [[ -z "$VERSION" ]]; then
echo "Version expected"
echo "Usage:"
echo "npm run release 1.0.0"
exit 1
fi

export NODE_ENV=production

npm i @diplodoc/cli@latest --no-workspaces

CLI_VERSION=$(node -pe 'require("./package.json").dependencies["@diplodoc/cli"]')

if [[ -n "$(git status -s | grep package.json)" ]]; then
git add package.json package-lock.json
git commit -m "Update cli to version $CLI_VERSION"
git push
if [[ -z "$(git status -s | grep package.json)" ]]; then
echo "Nothing to release"
fi

if [[ -n "$(git status -s)" ]]; then
echo "Unable to release unstaged changes"
git status -s
exit 1
fi
VERSION=$(node -pe 'require("./package.json").dependencies["@diplodoc/cli"].slice(1)')

git add package.json package-lock.json
git commit -m "Update cli to version $VERSION"
git push
git tag v$VERSION
git push origin v$VERSION

0 comments on commit 8cf9445

Please sign in to comment.