-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prep for making maven central releases
- Loading branch information
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- '*' # Push events to every tag not containing / | ||
|
||
jobs: | ||
build: | ||
name: Build and Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: gradle | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- run: echo "Build status report=${{ job.status }}." | ||
- name: Deploy to Sonatype / Maven Central | ||
# see signing variable names here: https://github.com/vanniktech/gradle-maven-publish-plugin/blob/da599468864f7be7f0c694f174baa797ba8bf189/plugin/src/integrationTest/kotlin/com/vanniktech/maven/publish/ProjectSpecRunner.kt#L229 | ||
run: ./gradlew -PcentralPortalToken='${{ secrets.CENTRAL_PORTAL_TOKEN }}' -PcentralPortalPassword='${{ secrets.CENTRAL_PORTAL_PASSWORD }}' -PsigningInMemoryKeyId='${{ secrets.SIGNING_KEY_ID }}' -PsigningInMemoryKeyPassword='${{ secrets.SIGNING_KEY_PASSWORD }}' -PsigningInMemoryKey='${{ secrets.SIGNING_KEY_IN_MEMORY }}' publishAllPublicationsToCentralPortal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ plugins { | |
alias(libs.plugins.jetbrains.kotlin.jvm) | ||
alias(libs.plugins.kotlinter) | ||
id("jacoco") | ||
alias(libs.plugins.git.version) // https://stackoverflow.com/a/71212144 | ||
alias(libs.plugins.sonatype.maven.central) | ||
alias(libs.plugins.gradleup.nmcp) | ||
} | ||
|
||
java { | ||
|
@@ -36,3 +39,55 @@ dependencies { | |
testRuntimeOnly(libs.junit.jupiter.engine) | ||
testImplementation(libs.logback.classic) | ||
} | ||
|
||
version = "0.0.0-SNAPSHOT" | ||
gitVersioning.apply { | ||
refs { | ||
branch(".+") { version = "\${ref}-SNAPSHOT" } | ||
tag("v(?<version>.*)") { version = "\${ref.version}" } | ||
} | ||
} | ||
|
||
// see: https://github.com/vanniktech/gradle-maven-publish-plugin/issues/747#issuecomment-2066762725 | ||
// and: https://github.com/GradleUp/nmcp | ||
nmcp { | ||
val props = project.properties | ||
publishAllPublications { | ||
username = props["centralPortalToken"] as String? ?: "" | ||
password = props["centralPortalPassword"] as String? ?: "" | ||
// or if you want to publish automatically | ||
publicationType = "AUTOMATIC" | ||
} | ||
} | ||
|
||
// see: https://vanniktech.github.io/gradle-maven-publish-plugin/central/#configuring-the-pom | ||
mavenPublishing { | ||
coordinates("com.jasonernst.packetdumper", "packetdumper", version.toString()) | ||
pom { | ||
name = "PacketDumper" | ||
description = "A kotlin / android compatible buffer / packet dumper." | ||
inceptionYear = "2024" | ||
url = "https://github.com/compscidr/packetdumper" | ||
licenses { | ||
license { | ||
name = "GPL-3.0" | ||
url = "https://www.gnu.org/licenses/gpl-3.0.en.html" | ||
distribution = "repo" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "compscidr" | ||
name = "Jason Ernst" | ||
url = "https://www.jasonernst.com" | ||
} | ||
} | ||
scm { | ||
url = "https://github.com/compscidr/packetdumper" | ||
connection = "scm:git:git://github.com/compscidr/packetdumper.git" | ||
developerConnection = "scm:git:ssh://[email protected]/compscidr/packetdumper.git" | ||
} | ||
} | ||
|
||
signAllPublications() | ||
} |