Skip to content

Commit bd68d2e

Browse files
committed
Publishing script improvements
1 parent 51a8899 commit bd68d2e

File tree

8 files changed

+56
-10
lines changed

8 files changed

+56
-10
lines changed

build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ buildscript {
1313
jcenter()
1414
}
1515
dependencies {
16-
classpath "com.android.tools.build:gradle:$androidGradleVersion"
16+
classpath "com.android.tools.build:gradle:$androidPluginVersion"
1717
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1818

19-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
20-
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
19+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayPluginVersion"
20+
classpath "com.github.dcendents:android-maven-gradle-plugin:$mavenPluginVersion"
21+
classpath "com.github.breadmoirai:github-release:$githubReleasePluginVersion"
2122

2223
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
2324
}

gradle.properties

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
android.useAndroidX=true
2-
31
# Library
42
libVersion=3.2.1
53

@@ -9,7 +7,13 @@ iconPackFaVersion=5.13.0
97
iconPackMdiVersion=5.0.45
108

119
# Dependencies
12-
androidGradleVersion=3.6.3
10+
android.useAndroidX=true
11+
12+
androidPluginVersion=3.6.3
13+
bintrayPluginVersion=1.8.4
14+
mavenPluginVersion=2.1
15+
githubReleasePluginVersion=2.2.12
16+
1317
kotlinVersion=1.3.72
1418
ktxVersion=1.2.0
1519
appCompatVersion=1.1.0

iconpacks/iconpack-default/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ tasks.withType(Javadoc).all {
4040
}
4141

4242
if (project.hasProperty("publishAll") || project.hasProperty("publishDefaultPack")) {
43-
apply from: "../../release.gradle"
43+
apply from: "../../publishing.gradle"
4444
}

iconpacks/iconpack-fa/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ dependencies {
3636
}
3737

3838
if (project.hasProperty("publishAll") || project.hasProperty("publishFaPack")) {
39-
apply from: "../../release.gradle"
39+
apply from: "../../publishing.gradle"
4040
}

iconpacks/iconpack-mdi/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ dependencies {
3636
}
3737

3838
if (project.hasProperty("publishAll") || project.hasProperty("publishMdiPack")) {
39-
apply from: "../../release.gradle"
39+
apply from: "../../publishing.gradle"
4040
}

lib/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id "com.android.library"
33
id "kotlin-android"
4+
id "com.github.breadmoirai.github-release"
45
}
56

67
ext {
@@ -54,5 +55,7 @@ dependencies {
5455
}
5556

5657
if (project.hasProperty("publishAll") || project.hasProperty("publishLib")) {
57-
apply from: "../release.gradle"
58+
apply from: "../publishing.gradle"
5859
}
60+
61+
apply from: "publishing.gradle"

lib/publishing.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
// Publish a new release to Github, using the lastest defined libVersion property,
3+
// a git tag, and the release notes in CHANGELOG.md.
4+
githubRelease {
5+
if (project.hasProperty("githubReleasePluginToken")) {
6+
token githubReleasePluginToken
7+
}
8+
owner "maltaisn"
9+
repo "icondialoglib"
10+
11+
tagName "v$libVersion"
12+
targetCommitish "master"
13+
releaseName "v$libVersion"
14+
15+
body {
16+
// Get release notes for version from changelog file.
17+
def changelog = file("../CHANGELOG.md")
18+
def lines = changelog.readLines()
19+
def versionChanges = new StringBuilder()
20+
def foundVersion = false
21+
for (line in lines) {
22+
if (foundVersion && line ==~ /^#+\s*v.+$/) {
23+
break
24+
} else if (line ==~ /^#+\s*v$libVersion$/) {
25+
foundVersion = true
26+
} else if (foundVersion) {
27+
versionChanges.append(line)
28+
versionChanges.append('\n')
29+
}
30+
}
31+
if (!foundVersion) {
32+
throw new GradleException("No release notes for version $libVersion")
33+
}
34+
return versionChanges.toString().trim()
35+
}
36+
37+
overwrite true
38+
}

release.gradle publishing.gradle

File renamed without changes.

0 commit comments

Comments
 (0)