1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-04 15:33:47 +00:00

add publication of github release via changelog

This commit is contained in:
InsanusMokrassar 2020-09-22 18:04:10 +06:00
parent 7043647584
commit 034901a479
5 changed files with 77 additions and 12 deletions

3
.gitignore vendored
View File

@ -8,3 +8,6 @@ settings.xml
.gradle/
build/
out/
local.properties
secret.gradle

View File

@ -44,7 +44,7 @@
### 0.28.3
* Common`:
* Common:
* Version updates:
* `Klock`: `0.12.0` -> `0.12.1`
* `Kotlin serialization`: `1.0.0-RC` -> `1.0.0-RC2` (dependency `kotlinx-serialization-core` was replaced with

View File

@ -3,12 +3,14 @@ buildscript {
mavenLocal()
jcenter()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
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"
}
}
@ -16,3 +18,49 @@ plugins {
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" apply false
}
ext {
enable_github_publish=new File(projectDir, "secret.gradle").exists()
changelog_from_file=""
}
if (ext.enable_github_publish) {
apply from: './secret.gradle'
apply plugin: "com.github.breadmoirai.github-release"
}
private String getCurrentVersionChangelog() {
OutputStream changelogDataOS = new ByteArrayOutputStream()
exec {
standardOutput = changelogDataOS
commandLine './changelog_info_retriever', "$library_version", 'CHANGELOG.md'
}
return changelogDataOS.toString().trim()
}
if (enable_github_publish && project.hasProperty('GITHUB_RELEASE_TOKEN')) {
String changelogFromFile = ""
githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}"
owner "InsanusMokrassar"
repo "TelegramBotAPI"
tagName "$library_version"
releaseName "$library_version"
targetCommitish "$library_version"
body getCurrentVersionChangelog()
}
// tasks.getByName("githubRelease").doFirst {
// OutputStream changelogDataOS = new ByteArrayOutputStream()
// exec {
// standardOutput = changelogDataOS
// commandLine './changelog_info_retriever', "$library_version", 'CHANGELOG.md'
// }
// changelogFromFile = changelogDataOS.toString().trim()
// ext.changelog_from_file = changelogFromFile
// }
}

View File

@ -1,16 +1,29 @@
#!/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
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

View File

@ -18,3 +18,4 @@ library_group=com.github.insanusmokrassar
library_version=0.28.3
gradle_bintray_plugin_version=1.8.5
github_release_plugin_version=2.2.12