Skip to content

Commit

Permalink
Merge pull request #409 from mockito/sf
Browse files Browse the repository at this point in the history
Automated releases
  • Loading branch information
mockitoguy authored Mar 14, 2021
2 parents 7486eda + 147adc8 commit 68237d0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 49 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: 3. Build with Kotlin ${{ matrix.kotlin }} and mock-maker ${{ matrix.mock-maker }}
run: |
ops/mockMakerInline.sh
./gradlew build bintrayUpload -PbintrayDryRun
./gradlew build
env:
KOTLIN_VERSION: ${{ matrix.kotlin }}
MOCK_MAKER: ${{ matrix.mock-maker }}
Expand Down Expand Up @@ -96,11 +96,11 @@ jobs:
with:
java-version: 8

- name: Build and publish to Bintray/MavenCentral
run: ./gradlew githubRelease bintrayUpload
- name: Build and release
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}}
6 changes: 2 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
To publish a release:
# Releasing

- Tag the commit on master: `git tag -a x.x.x -m x.x.x && git push --tags`
- Execute the release process: `./gradlew clean test bintraySign mavenCentralSync -PisRelease=true`
- Don't forget to publish the tag on Github with release notes :)
Every change on the main development branch is released to Maven Central.
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
}
}
1 change: 0 additions & 1 deletion mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
}
}

Expand Down

0 comments on commit 68237d0

Please sign in to comment.