forked from slackhq/circuit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·31 lines (23 loc) · 846 Bytes
/
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
#!/usr/bin/env bash
set -exo pipefail
# Gets a property out of a .properties file
# usage: getProperty $key $filename
function getProperty() {
grep "${1}" "$2" | cut -d'=' -f2
}
NEW_VERSION=$1
SNAPSHOT_VERSION=$(getProperty 'VERSION_NAME' gradle.properties)
echo "Publishing $NEW_VERSION"
# Prepare release
sed -i '' "s/${SNAPSHOT_VERSION}/${NEW_VERSION}/g" gradle.properties
git commit -am "Prepare for release $NEW_VERSION."
git tag -a "$NEW_VERSION" -m "Version $NEW_VERSION"
# Publish
./gradlew publish -x dokkaHtml --no-configuration-cache
# Prepare next snapshot
echo "Restoring snapshot version $SNAPSHOT_VERSION"
sed -i '' "s/${NEW_VERSION}/${SNAPSHOT_VERSION}/g" gradle.properties
./gradlew spotlessApply --no-configuration-cache
git commit -am "Prepare next development version."
# Push it all up
git push && git push --tags