Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Setup OSS publishing and signing artifacts #25

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Build with Gradle Wrapper
run: ./gradlew build koverXmlReport publishToMavenLocal
run: ./gradlew build koverXmlReport publish
env:
JUNIT5_ROBOLECTRIC_EXTENSION_MAVEN_USERNAME: '${{ secrets.JUNIT5_ROBOLECTRIC_EXTENSION_MAVEN_USERNAME }}'
JUNIT5_ROBOLECTRIC_EXTENSION_MAVEN_PASSWORD: '${{ secrets.JUNIT5_ROBOLECTRIC_EXTENSION_MAVEN_PASSWORD }}'
JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_KEY: '${{ secrets.JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_KEY }}'
JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD: '${{ secrets.JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD }}'
- name: Upload coverage report
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: ${{ hashFiles('build/reports/kover/report.xml') != '' }}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

allprojects {
group = 'tech.apter.junit5.jupiter'
version = property('apter.junit5.robolectric.extension.version')
version = property('tech.apter.junit5.robolectric.extension.version')
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
android.useAndroidX=true
kotlin.code.style=official
apter.junit5.robolectric.extension.version=0.1.0-SNAPSHOT
tech.apter.junit5.robolectric.extension.version=0.1.0-SNAPSHOT
33 changes: 24 additions & 9 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

tasks.register('dokkaJavadocJar', Jar) {
dependsOn dokkaJavadoc
archiveClassifier.set 'javadoc'
from javadoc.destinationDir
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down Expand Up @@ -44,8 +50,8 @@ publishing {
repositories {
maven {
name = 'MavenCentral'
final releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
final snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
final releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
final snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots'
url = version.toString().endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv('JUNIT5_ROBOLECTRIC_EXTENSION_MAVEN_USERNAME')
Expand All @@ -55,10 +61,19 @@ publishing {
}
}

//signing {
// useInMemoryPgpKeys(
// System.getenv('JUNIT5_ROBOLECTRIC_EXTENSION_PGP_SIGNING_KEY'),
// System.getenv('JUNIT5_ROBOLECTRIC_EXTENSION_PGP_SIGNING_PASSWORD'),
// )
// sign(publishing.publications["mavenJava"])
//}
final JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_KEY = System.getenv(
'JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_KEY'
) ?: ""
final JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD = System.getenv(
'JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD'
) ?: ""

if (!JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_KEY.isEmpty() && !JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD.isEmpty()) {
signing {
useInMemoryPgpKeys(
JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_KEY,
JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD,
)
sign(publishing.publications["mavenJava"])
}
}
6 changes: 0 additions & 6 deletions robolectric-extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ dependencies {
testRuntimeOnly(libs.junit5JupiterEngine)
}

tasks.register('dokkaJavadocJar', Jar) {
dependsOn dokkaJavadoc
archiveClassifier.set 'javadoc'
from javadoc.destinationDir
}

private void bashExecute(String command) {
final process = command.execute()
final error = process.errorReader().readLines().join("\n")
Expand Down
Loading