Skip to content

Commit

Permalink
chore: use full version in script and stop relying on pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
adriencaccia committed Dec 1, 2023
1 parent 5a53587 commit de30d2b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
# Usage: ./scripts/release.sh <major|minor|patch>
# Usage: ./scripts/release.sh <version>
set -ex

if [ $# -ne 1 ]; then
echo "Usage: ./release.sh <major|minor|patch>"
echo "Usage: ./release.sh <version>"
exit 1
fi

Expand All @@ -13,17 +13,16 @@ if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then
exit 1
fi
git diff --exit-code
pnpm format-check
pnpm lint
pnpm build

# Bump version
pnpm version $1 --git-tag-version=false
pnpm build
NEW_VERSION=$(pnpm version --json | jq '.["@codspeed/action"]' --raw-output)
NEW_VERSION=$1
# verify that NEW_VERSION is a valid semver
if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version must be a valid semver (e.g. 1.2.3)"
exit 1
fi
MAJOR_VERSION=$(echo $NEW_VERSION | cut -d. -f1)

git add package.json dist/index.js
# Fail if there are any unstaged changes left
git diff --exit-code
git commit -m "Release v$NEW_VERSION 🚀"
Expand All @@ -32,4 +31,4 @@ git tag -fa v$MAJOR_VERSION -m "Release v$NEW_VERSION 🚀"
git push origin v$NEW_VERSION
git push -f origin v$MAJOR_VERSION
git push --follow-tags
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d

0 comments on commit de30d2b

Please sign in to comment.