Skip to content

Commit

Permalink
build: improve release script checks
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding committed Dec 5, 2024
1 parent 01129af commit ee848fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"capacitor:copy:before": "rm -rf $CAPACITOR_WEB_DIR/splash && rm -rf $CAPACITOR_WEB_DIR/screenshots",
"upgrade:packageManager": "corepack use pnpm@latest",
"upgrade:react": "pnpm i --save react@experimental react-dom@experimental babel-plugin-react-compiler@experimental eslint-plugin-react-compiler@experimental eslint-plugin-react-hooks@experimental",
"release": "release-it && echo 'Version successfully bumped, but release not yet cut!' && ./scripts/postrelease.sh"
"release": "./scripts/prerelease.sh"
},
"imports": {
"#/*": "./src/*"
Expand Down
16 changes: 16 additions & 0 deletions scripts/prerelease.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Use Node.js to read the version from package.json
version=$(node -p "require('./package.json').version")

# Check if the git tag exists on the remote (origin) without 'v' prefix
if git ls-remote --tags origin "$version" | grep -q "refs/tags/$version"; then
echo "Tag $version exists on origin (was released), proceeding with bump..."
pnpm exec release-it
echo 'Version successfully bumped, but release not yet cut!'
else
echo "Tag $version does not exist on origin."
echo "This means $version hasn't been released yet."
fi

./scripts/postrelease.sh
File renamed without changes.

0 comments on commit ee848fe

Please sign in to comment.