-
Notifications
You must be signed in to change notification settings - Fork 11
/
release.sh
executable file
·56 lines (44 loc) · 1.4 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
55
56
#!/bin/bash
### Release management and changelog generation script. ###
set -e
changelog() {
# NOTE: This requires github_changelog_generator to be installed.
# https://github.com/skywinder/github-changelog-generator
if [ -z "$NEXT" ]; then
NEXT="Unreleased"
fi
echo "Generating changelog upto version: $NEXT"
github_changelog_generator \
--user "leapfrogtechnology" \
--project "async-store" \
--token $GITHUB_TOKEN \
--no-verbose \
--pr-label "**Changes**" \
--bugs-label "**Bug Fixes**" \
--issues-label "**Closed Issues**" \
--issue-line-labels=ALL \
--future-release="$NEXT" \
--release-branch=main \
--exclude-labels=unnecessary,duplicate,question,invalid,wontfix
}
bump() {
# Bump package version and generate changelog
VERSION="${NEXT/v/}"
echo "Bump version to ${VERSION}"
# Update version in the following files
sed -i "s/\(\"version\":\s*\"\)[^\"]*\(\"\)/\1${VERSION}\2/g" package.json
# Generate change log
changelog
echo ""
# Generate new build.
yarn && yarn test && yarn build
# Prepare to commit
git add CHANGELOG.md package.json yarn.lock && \
git commit -v --edit -m "${VERSION} Release :tada: :fireworks: :bell:" && \
git tag "$NEXT" && \
echo -e "\nRelease tagged $NEXT"
git push origin HEAD --tags
yarn publish --new-version "${VERSION}" --no-git-tag-version
}
# Run command received from args.
$1