Skip to content

Commit

Permalink
Add automatic versioning and changelog creation (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
boguszpawlowski committed Aug 17, 2021
1 parent ad4e42f commit 77804a1
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Cache Gradle
uses: actions/cache@v2
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Cache Gradle
uses: actions/cache@v2
Expand All @@ -35,5 +37,16 @@ jobs:
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SONATYPE_NEXUS_SIGNING_KEY_PASSWORD }}
run: ./gradlew :library:publish --no-daemon --no-parallel --stacktrace

- name: Publish release
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel

- name: Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew githubRelease

- name: Stop Gradle
run: ./gradlew --stop
59 changes: 39 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ plugins {
id(DetektLib.PluginId) version DetektLib.Version
id(GradleVersions.PluginId) version GradleVersions.Version
id(GrGit.PluginId) version GrGit.Version
id(Shipkit.AutoVersion.PluginId) version Shipkit.AutoVersion.Version
id(Shipkit.Changelog.PluginId) version Shipkit.Changelog.Version
id(Shipkit.GithubRelease.PluginId) version Shipkit.GithubRelease.Version
}

buildscript {
Expand Down Expand Up @@ -62,30 +65,46 @@ dependencies {
detekt(DetektLib.Cli)
}

tasks.withType<Detekt> {
parallel = true
config.setFrom(rootProject.file("detekt-config.yml"))
setSource(files(projectDir))
exclude(subprojects.map { "${it.buildDir.relativeTo(rootDir).path}/" })
exclude("**/.gradle/**")
reports {
xml {
enabled = true
destination = file("build/reports/detekt/detekt-results.xml")
tasks {
withType<Detekt> {
parallel = true
config.setFrom(rootProject.file("detekt-config.yml"))
setSource(files(projectDir))
exclude(subprojects.map { "${it.buildDir.relativeTo(rootDir).path}/" })
exclude("**/.gradle/**")
reports {
xml {
enabled = true
destination = file("build/reports/detekt/detekt-results.xml")
}
html.enabled = false
txt.enabled = false
}
html.enabled = false
txt.enabled = false
}
}

tasks.register("check") {
group = "Verification"
description = "Allows to attach Detekt to the root project."
}
register("check") {
group = "Verification"
description = "Allows to attach Detekt to the root project."
}

withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}

withType(org.shipkit.changelog.GenerateChangelogTask::class) {
previousRevision = project.ext["shipkit-auto-version.previous-tag"] as String?
githubToken = System.getenv("GITHUB_TOKEN")
repository = "boguszpawlowski/composecalendar"
}

tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
withType(org.shipkit.github.release.GithubReleaseTask::class) {
dependsOn(named("generateChangelog"))
repository = "boguszpawlowski/composecalendar"
changelog = named("generateChangelog").get().outputs.files.singleFile
githubToken = System.getenv("GITHUB_TOKEN")
newTagRevision = System.getenv("GITHUB_SHA")
}
}

Expand Down
20 changes: 20 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ object GrGit {
const val PluginId = "org.ajoberstar.grgit"
}

object Shipkit {
object AutoVersion {
const val Version = "1.1.19"

const val PluginId = "org.shipkit.shipkit-auto-version"
}

object Changelog {
const val Version = "1.1.15"

const val PluginId = "org.shipkit.shipkit-changelog"
}

object GithubRelease {
const val Version = "1.1.15"

const val PluginId = "org.shipkit.shipkit-github-release"
}
}

object Coroutines {
const val Version = "1.4.3"

Expand Down
1 change: 0 additions & 1 deletion library/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ POM_NAME=Compose Calendar
POM_PACKAGING=aar

GROUP=io.github.boguszpawlowski.composecalendar
VERSION_NAME=0.1.1-SNAPSHOT
POM_DESCRIPTION=Library for handling the Calendar view in Jetpack Compose.

POM_URL=https://github.com/boguszpawlowski/ComposeCalendar
Expand Down

0 comments on commit 77804a1

Please sign in to comment.