-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
30 lines (23 loc) · 805 Bytes
/
release.sh
File metadata and controls
30 lines (23 loc) · 805 Bytes
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
#!/bin/bash
set -e -x
#git pull -r
# Remove '-dev' from the version file to prepare for release.
ver="$(cat VERSION | sed -e 's/-dev$//')"
echo $ver > VERSION.tmp
mv -f VERSION.tmp VERSION
MAJOR=$(echo "${ver}" | sed -e 's/\.[0-9]*\.[0-9]*$//')
MINOR=$(echo "${ver}" | sed -e 's/^[0-9]*\.//' | sed -e 's/\.[0-9]*$//')
PATCH=$(echo "${ver}" | sed -e 's/^[0-9]*.[0-9]*.//')
PATCH=$(( $PATCH + 1 ))
# Tag a release
echo "Releasing version: ${ver}"
git commit -am "Version $ver"
git tag "$ver"
git push origin "$ver"
# Advance to the next patch release, add the '-dev' suffix back on, and commit the result.
NEW_VERSION="$MAJOR.$MINOR.$PATCH-dev"
echo "Setting new version: ${NEW_VERSION}"
echo "$NEW_VERSION" > VERSION
git add VERSION
git commit -m "Back to -dev: $NEW_VERSION"
git push origin master