add github release mechanism

This commit is contained in:
InsanusMokrassar 2020-10-02 20:45:16 +06:00
parent 04e6c7b574
commit 17c6d4a889
5 changed files with 59 additions and 0 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ settings.xml
.gradle/
build/
out/
secret.gradle

View File

@ -9,6 +9,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version"
classpath "com.github.breadmoirai:github-release:$github_release_plugin_version"
}
}
@ -20,3 +21,4 @@ repositories {
}
apply from: "./extensions.gradle"
apply from: "./github.gradle"

27
changelog_info_retriever Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
function parse() {
version=$1
read -r
while [ -z "`echo $REPLY | grep -e "^#\+ $version"`" ]
do
read -r
done
read -r
while [ -z "`echo $REPLY | grep -e "^#\+"`" ]
do
echo "$REPLY"
read -r
done
}
version=$1
file=$2
if [ -n "$file" ]; then
parse $version < "$file"
else
parse $version
fi

27
github_release.gradle Normal file
View File

@ -0,0 +1,27 @@
private String getCurrentVersionChangelog() {
OutputStream changelogDataOS = new ByteArrayOutputStream()
exec {
standardOutput = changelogDataOS
commandLine './changelog_info_retriever', "$library_version", 'CHANGELOG.md'
}
return changelogDataOS.toString().trim()
}
if (new File(projectDir, "secret.gradle").exists()) {
apply from: './secret.gradle'
apply plugin: "com.github.breadmoirai.github-release"
githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}"
owner "InsanusMokrassar"
repo "MicroUtils"
tagName "$library_version"
releaseName "$library_version"
targetCommitish "$library_version"
body getCurrentVersionChangelog()
}
}

View File

@ -10,6 +10,7 @@ ktor_version=1.4.1
klockVersion=1.12.1
gradle_bintray_plugin_version=1.8.5
github_release_plugin_version=2.2.12
uuidVersion=0.2.2