-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
release.sh
for release chores (#565)
* feat: add `release.sh` for release chores wip * fixup! * use npx git-cliff * refactor: remove license change from release script --------- Co-authored-by: michael1011 <[email protected]>
- Loading branch information
1 parent
e8a9689
commit accef30
Showing
1 changed file
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to release a new version of the bolt-web-app | ||
# It will: | ||
# - create a new branch with the tag name and update the version in package.json | ||
# - generate a changelog and release notes | ||
# - create a branch, commit the changes and push them to the remote repository | ||
# - create a pull request with the changes | ||
|
||
# Check if required dependencies are installed | ||
if ! command -v gh &> /dev/null | ||
then | ||
echo "gh could not be found" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v npx git-cliff &> /dev/null | ||
then | ||
echo "npx git-cliff could not be found" | ||
exit 1 | ||
fi | ||
|
||
tag=$1 | ||
if [ -z "$tag" ]; then | ||
echo "Usage: release.sh <tag>" | ||
exit 1 | ||
fi | ||
|
||
git checkout -b $tag | ||
|
||
sed -i "s/\"version\": \".*\"/\"version\": \"$tag\"/" package.json | ||
npm i | ||
|
||
# Generate changelog after we updated the version | ||
npx git-cliff -o CHANGELOG.md -t $tag | ||
|
||
git add package.json package-lock.json LICENSE CHANGELOG.md | ||
|
||
# Commit and create pull request | ||
commit_message="chore: update version to $tag and prepare release" | ||
|
||
git commit -m "$commit_message" | ||
|
||
git push origin $tag | ||
gh pr create --title "$commit_message" --base main --head $tag --body "$commit_message" | ||
|
||
echo "1. Review the release notes" | ||
echo "2. Merge the pull request" | ||
echo "3. Pull latest main" | ||
echo "4. Run the following commands to create the release" | ||
echo "git tag -s -m "$tag"" | ||
echo "git push --tags" | ||
echo "gh release create "$tag" -F release.md" | ||
echo "rm release.md" |