Skip to content

Commit e3bd1f7

Browse files
committed
chore(build): add release script
1 parent 1a5f5e8 commit e3bd1f7

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (hasProperty("release")) {
1414
apply(plugin = "maven-publish")
1515
apply(plugin = "org.jetbrains.dokka")
1616
group = "dev.krud"
17-
version = "0.3.0-SNAPSHOT"
17+
version = extra["shapeshift.version"] ?: error("shapeshift.version is not set")
1818
java.sourceCompatibility = JavaVersion.VERSION_1_8
1919
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
2020
val repoUri = if (isSnapshot) {

ops/release.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright KRUD 2022
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
#
8+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
#
10+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
#
12+
13+
set -e
14+
15+
VERSION=$1
16+
17+
# Exit if git tree is not clean
18+
if [ -n "$(git status --porcelain)" ]; then
19+
echo "Git tree is not clean, aborting release."
20+
exit 1
21+
fi
22+
23+
# Exit if version is not correct
24+
if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25+
echo "Version is not correct, aborting release."
26+
exit 1
27+
fi
28+
29+
# Tag release and publish changelog
30+
conventional-changelog -p angular -i CHANGELOG.md -s -r 0
31+
sed -i '' -E "s/<version>.*<\/version>/<version>$VERSION<\/version>/g" README.md
32+
sed -i '' -E "s/dev.krud:shapeshift:([0-9]+\.[0-9]+\.[0-9]+)/dev.krud:shapeshift:$VERSION/g" README.md
33+
git add CHANGELOG.md
34+
git add README.md
35+
git commit -m "chore(release): release v$VERSION"
36+
./gradlew -Prelease -Pshapeshift.version=$VERSION clean jar publishAllPublicationsToOSSRHRepository
37+
git tag -a v$VERSION -m "Release v$VERSION"
38+
#git push origin v$VERSION

0 commit comments

Comments
 (0)