Skip to content

Commit

Permalink
Release: Prepare for v0.2.5, update Release pattern. (#43)
Browse files Browse the repository at this point in the history
Bump release version, update release patterns to be closer to convention.
  • Loading branch information
Nava2 authored Jun 14, 2024
1 parent 8f3652f commit fd88b68
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 74 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ jobs:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Set release snapshot version
run: |
sed -i.bak -e '/^VERSION_NAME*/ s/$/-'"$GITHUB_SHA"'-SNAPSHOT/' gradle.properties && rm gradle.properties.bak
- name: Setup gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Verify build
run: ./gradlew check

- name: Publish the artifacts
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
permissions:
contents: read

env:
RELEASE: true

steps:
- name: Checkout the repo
uses: actions/checkout@v4
Expand All @@ -26,6 +29,10 @@ jobs:
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Verify build
run: ./gradlew check

- name: Publish the artifacts
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ convention of the project) to allow test code access to the annotated members.

## Type Resolution
A number of the rules require [type resolution](https://detekt.dev/docs/gettingstarted/type-resolution/) to be enabled to function properly. If type resolution is not enabled, the rules will silently continue.

# Releasing

To release a new version:

1. Create a PR that bumps the `version` in [`build.gradle.kts`](./build.gradle.kts).
2. Once this PR merges with the new version and completes CI, create a new version through Github releases
150 changes: 83 additions & 67 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,99 +1,115 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
kotlin("jvm") version "1.9.24"
alias(libs.plugins.maven.publishing)
alias(libs.plugins.kotlin)
alias(libs.plugins.maven.publishing)

id("io.gitlab.arturbosch.detekt") version "1.23.6"
alias(libs.plugins.detekt)
}

group = "com.faire.detektrules"
version = "0.1.0"
group = "com.faire"
version = "0.2.5"

if (!providers.environmentVariable("RELEASE").isPresent) {
val gitSha = providers.environmentVariable("GITHUB_SHA")
.orElse(
provider {
// nest the provider, we don't want to invalidate the config cache for this
providers.exec { commandLine("git", "rev-parse", "--short", "HEAD") }
.standardOutput
.asText
.get()
}
)
.get()

version = "$version-$gitSha-SNAPSHOT"
}

val detektVersion = "1.23.6"
val detektVersion = libs.versions.detekt.get()

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("compiler-embeddable"))
runtimeOnly(kotlin("reflect"))
implementation(kotlin("stdlib"))
implementation(kotlin("compiler-embeddable"))
runtimeOnly(kotlin("reflect"))

implementation(libs.detekt.api)
implementation(libs.detekt.api)

runtimeOnly(libs.detekt.formatting)
runtimeOnly(libs.detekt.formatting)

testImplementation(libs.assertj)
testImplementation(libs.detekt.test)
testImplementation(libs.guava)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.assertj)
testImplementation(libs.detekt.test)
testImplementation(libs.guava)
testImplementation(libs.junit.jupiter.api)

testRuntimeOnly(libs.junit.jupiter.engine)
testRuntimeOnly(libs.junit.jupiter.engine)

detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-ruleauthors:$detektVersion")
detektPlugins("com.braisgabin.detekt:kotlin-compiler-wrapper:0.0.4")
detektPlugins(rootProject)
detektPlugins(libs.detekt.formatting)
detektPlugins(libs.detekt.ruleauthors)
detektPlugins(libs.detekt.compiler.wrapper)
detektPlugins(rootProject)
}

detekt {
parallel = true
autoCorrect = true
parallel = true
autoCorrect = true

buildUponDefaultConfig = true
config.from(rootProject.file("detekt.yaml"))
buildUponDefaultConfig = true
config.from(rootProject.file("detekt.yaml"))

allRules = false // activate all available (even unstable) rules.
allRules = false // activate all available (even unstable) rules.
}

tasks.test {
useJUnitPlatform()
useJUnitPlatform()
}

kotlin {
jvmToolchain(8)
jvmToolchain(8)
}

mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT, true)
signAllPublications()

pom {
name = "faire-detekt-rules"
description = "Detekt rules for Faire"
inceptionYear = "2023"
url = "https://github.com/Faire/faire-detekt-rules"

licenses {
license {
name = "The Apache License, Version 2.0"
distribution = "repo"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
id = "Faire"
name = "Faire Developers"
}
}

organization {
name = "Faire"
url = "https://www.faire.com"
}

issueManagement {
system = "GitHub"
url = "https://github.com/Faire/faire-detekt-rules/issues"
}

scm {
connection = "scm:git:git://github.com/Faire/faire-detekt-rules.git"
url = "https://github.com/Faire/faire-detekt-rules"
}
publishToMavenCentral(SonatypeHost.DEFAULT, true)
signAllPublications()

pom {
name = "faire-detekt-rules"
description = "Detekt rules for Faire"
inceptionYear = "2023"
url = "https://github.com/Faire/faire-detekt-rules"

licenses {
license {
name = "The Apache License, Version 2.0"
distribution = "repo"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
id = "Faire"
name = "Faire Developers"
}
}

organization {
name = "Faire"
url = "https://www.faire.com"
}
}

issueManagement {
system = "GitHub"
url = "https://github.com/Faire/faire-detekt-rules/issues"
}

scm {
connection = "scm:git:git://github.com/Faire/faire-detekt-rules.git"
url = "https://github.com/Faire/faire-detekt-rules"
}
}
}
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
kotlin.code.style=official

GROUP=com.faire
POM_ARTIFACT_ID=faire-detekt-rules
VERSION_NAME=0.2.4
org.gradle.configuration-cache=true

6 changes: 5 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
assertj = "3.20.2"
detekt = "1.23.6"
guava = "33.2.1-jre"
kotlin = "1.9.24"
junit-jupiter = "5.10.2"
junit-platform = "1.10.2"

Expand All @@ -14,6 +15,8 @@ detekt-test = { group = "io.gitlab.arturbosch.detekt", name = "detekt-test", ver
detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" }
detekt-ruleauthors = { group = "io.gitlab.arturbosch.detekt", name = "detekt-rules-ruleauthors", version.ref = "detekt" }

detekt-compiler-wrapper = { group = "com.braisgabin.detekt", name = "kotlin-compiler-wrapper", version = "0.0.4" }

guava = { module = "com.google.guava:guava", version.ref = "guava" }

# JUnit 5 libs.
Expand All @@ -29,5 +32,6 @@ junit-platform-reporting = { module = "org.junit.platform:junit-platform-reporti


[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
maven-publishing = { id = "com.vanniktech.maven.publish", version = "0.28.0"}
maven-publishing = { id = "com.vanniktech.maven.publish", version = "0.28.0"}

0 comments on commit fd88b68

Please sign in to comment.