Skip to content

Commit

Permalink
Automated releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Szczepan Faber committed Mar 13, 2021
1 parent 7486eda commit 58f4892
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ jobs:
java-version: 8

- name: Build and publish to Bintray/MavenCentral
run: ./gradlew githubRelease bintrayUpload
run: ./gradlew githubRelease publishToSonatype # closeAndReleaseStagingRepository
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
BINTRAY_API_KEY: ${{secrets.BINTRAY_API_KEY}}
NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}}
NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}}

PGP_KEY: ${{secrets.PGP_KEY}}
PGP_PWD: ${{secrets.PGP_PWD}}
18 changes: 16 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
plugins {
id "org.shipkit.shipkit-auto-version" version "1.1.1"
id "org.shipkit.shipkit-changelog" version "1.1.1"
id "org.shipkit.shipkit-github-release" version "1.1.1"
id "org.shipkit.shipkit-changelog" version "1.1.10"
id "org.shipkit.shipkit-github-release" version "1.1.10"
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
}

//TODO: change java packages to "org.mockito.kotlin"
group = 'org.mockito.kotlin'

tasks.named("generateChangelog") {
previousRevision = project.ext.'shipkit-auto-version.previous-tag'
githubToken = System.getenv("GITHUB_TOKEN")
Expand All @@ -19,3 +23,13 @@ tasks.named("githubRelease") {
newTagRevision = System.getenv("GITHUB_SHA")
}

nexusPublishing {
repositories {
if (System.getenv("NEXUS_TOKEN_PWD")) {
sonatype {
username = System.getenv("NEXUS_TOKEN_USER")
password = System.getenv("NEXUS_TOKEN_PWD")
}
}
}
}
42 changes: 5 additions & 37 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
apply plugin: 'maven-publish'

//TODO: update the group to 'org.mockito' ***AND*** change java packages
group = 'com.nhaarman.mockitokotlin2'

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/javadoc'
Expand Down Expand Up @@ -63,39 +60,10 @@ tasks.withType(GenerateModuleMetadata) {
//fleshes out problems with Maven pom generation when building
tasks.build.dependsOn('publishJavaLibraryPublicationToMavenLocal')

//Bintray Gradle plugin configuration (https://github.com/bintray/gradle-bintray-plugin)
//Plugin jars are added to the buildscript classpath in the root build.gradle file
apply plugin: 'com.jfrog.bintray'

bintray {
//We need to use some user id here, because the Bintray key is associated with the user
//However, any user id is good, so longer the user has necessary privileges to the repository
user = 'szczepiq' //https://bintray.com/szczepiq
key = System.getenv('BINTRAY_API_KEY')
publish = false //can be changed to 'false' for testing
dryRun = project.hasProperty('bintrayDryRun')

publications = ['javaLibrary']

pkg {
repo = 'test' //https://bintray.com/mockito/maven // TODO change to 'maaven' when CI ready
userOrg = 'mockito' //https://bintray.com/mockito

name = 'mockito-kotlin'

licenses = ['MIT']
labels = ['kotlin', 'mockito']
vcsUrl = 'https://github.com/mockito/mockito-kotlin.git'

version {
name = project.version
vcsTag = "v$project.version"

mavenCentralSync {
sync = false // TODO enable after CI+bintray integration is ready
user = System.getenv('NEXUS_TOKEN_USER')
password = System.getenv('NEXUS_TOKEN_PWD')
}
}
apply plugin: 'signing' //https://docs.gradle.org/current/userguide/signing_plugin.html
signing {
if (System.getenv("PGP_KEY")) {
useInMemoryPgpKeys(System.getenv("PGP_KEY"), System.getenv("PGP_PWD"))
sign publishing.publications.javaLibrary
}
}

0 comments on commit 58f4892

Please sign in to comment.