-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathrelease.sh
executable file
·54 lines (42 loc) · 1.38 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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"