Skip to content

Commit 2e630ab

Browse files
committed
Steal the java buildpack's release script
This will make releasing new versions easier for us. Closes gh-723
1 parent 83d5d6c commit 2e630ab

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

etc/publish.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
BP_NAME=${1:-"heroku/python"}
6+
7+
curVersion=$(heroku buildpacks:versions "$BP_NAME" | awk 'FNR == 3 { print $1 }')
8+
newVersion="v$((curVersion + 1))"
9+
10+
read -p "Deploy as version: $newVersion [y/n]? " choice
11+
case "$choice" in
12+
y|Y ) echo "";;
13+
n|N ) exit 0;;
14+
* ) exit 1;;
15+
esac
16+
17+
originMaster=$(git rev-parse origin/master)
18+
echo "Tagging commit $originMaster with $newVersion... "
19+
git tag "$newVersion" "${originMaster:?}"
20+
git push origin refs/tags/$newVersion
21+
22+
heroku buildpacks:publish "$BP_NAME" "$newVersion"
23+
24+
if [ $(git tag | grep -q previous-version) ]; then
25+
echo "Updating previous-version tag"
26+
git tag -d previous-version
27+
git push origin :previous-version
28+
git tag previous-version latest-version
29+
fi
30+
if [ $(git tag | grep -q latest-version) ]; then
31+
echo "Updating latest-version tag"
32+
git tag -d latest-version
33+
git push origin :latest-version
34+
git tag latest-version "${originMaster:?}"
35+
git push --tags
36+
fi
37+
38+
echo "Done."

0 commit comments

Comments
 (0)