Skip to content

Commit

Permalink
feat: add release.sh for release chores (#565)
Browse files Browse the repository at this point in the history
* 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
dni and michael1011 authored May 16, 2024
1 parent e8a9689 commit accef30
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions release.sh
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"

0 comments on commit accef30

Please sign in to comment.