This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.bash
executable file
·82 lines (63 loc) · 1.65 KB
/
release.bash
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
set -e
# add github tag
# upload app to
VERSION=${1?"Usage: ./release.bash <VERSION> [<COMMIT>]"}
COMMIT=${2:-$(git rev-parse HEAD)}
echo "Releasing version $VERSION from commit $COMMIT"
while true; do
read -rp "Is this correct (y/n)" yn
case $yn in
[Yy]*) break;;
[Nn]*) exit;;
*) echo "Please answer y or n.";;
esac
done
# create git release
git checkout main
git pull
if ! git diff --exit-code main origin/main
then
echo "ERROR! There are local-only changes on branch 'main'!"
exit 1
fi
git checkout -b "release-$VERSION" "$COMMIT"
# clean
echo "Cleaning up..."
git clean -f
make clean
echo "Done."
# update version
echo "Updating the version and building fresh theme..."
sed -i -e 's/ "version": "[0-9.]\+",/ "version": "'"$VERSION"'",/' package.json
git add package.json
# build fresh version of theme
make build
git add .
git commit -m"Prepare for $VERSION release
[skip ci]"
echo "Done."
git checkout release
if ! git diff --exit-code release origin/release
then
echo "ERROR! There are local-only changes on branch 'release'!"
exit 1
fi
# version change will include a conflict, resolve it by using the version from the release branch
git merge -s recursive -X theirs "release-$VERSION" -m "Release $VERSION"
git tag "$VERSION"
git push origin release
git push origin "$VERSION"
# build packages upload to PyPI
echo "Building Python Packages..."
make python-packages
echo "Done."
echo "Uploading Python Packages to PyPI..."
make upload-to-pypi
echo "Done."
# merge back to main
echo "Merging back to main..."
git checkout main
git merge "release-$VERSION"
git push origin main
echo "Done."