-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
57 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Ensure script exits on any command failure | ||
set -e | ||
|
||
# Check if a release type argument is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <release-type>" | ||
echo "release-type: patch | minor" | ||
exit 1 | ||
fi | ||
|
||
RELEASE_TYPE=$1 | ||
ROOT_DIR=$(pwd) | ||
|
||
if [[ "$RELEASE_TYPE" != "patch" && "$RELEASE_TYPE" != "minor" ]]; then | ||
echo "Invalid release type. Use 'patch' or 'minor'." | ||
exit 1 | ||
fi | ||
|
||
echo "Executing release: $RELEASE_TYPE" | ||
|
||
# Execute the appropriate npm release command | ||
if [[ "$RELEASE_TYPE" == "patch" ]]; then | ||
npm run release:patch | ||
elif [[ "$RELEASE_TYPE" == "minor" ]]; then | ||
npm run release:minor | ||
fi | ||
|
||
# Retrieve the new version from package.json | ||
NEW_VERSION=$(jq -r '.version' "$ROOT_DIR/package.json") | ||
|
||
if [ -z "$NEW_VERSION" ]; then | ||
echo "Failed to retrieve the version from package.json." | ||
exit 1 | ||
fi | ||
|
||
|
||
# Commit and push changes | ||
echo "Committing and pushing changes..." | ||
git add . | ||
git commit -m "build: v$NEW_VERSION" | ||
|
||
# Add git tag | ||
echo "Tagging version v$NEW_VERSION" | ||
git tag "v$NEW_VERSION" | ||
git push origin main --tags | ||
|
||
echo "Release ($RELEASE_TYPE) completed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ LICENSE | |
.next | ||
*.swp | ||
/scripts | ||
*.sh |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters