Skip to content

Commit

Permalink
Migrated to new Shipkit libraries
Browse files Browse the repository at this point in the history
- no version bump and release notes commits
- supports concurrent merges
- no change to the behavior / contents of the published libraries

More details: mockito/mockito#2069
  • Loading branch information
mockitoguy committed Nov 21, 2020
1 parent 25b7d21 commit 3ececd8
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 50 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ branches:
except:
- /^v\d/

#Build and perform release (if needed)

script:
- ./gradlew build -s && ./gradlew ciPerformRelease
# To validate changes, we run building and bintray upload in dry run. This happens on every build, even PRs.
# To publish, we perform github release and perform bintray upload (no dry run). This only for main branch builds.
- >
./gradlew resolveVersion
&& ./gradlew build bintrayUpload -PbintrayDryRun
&& if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "release/1.x" ];
then ./gradlew bintrayUpload githubRelease; fi
17 changes: 12 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@ buildscript {
}

dependencies {
classpath "org.shipkit:shipkit:2.0.26"
//Using buildscript.classpath so that we can resolve plugins from maven local, during local testing
classpath "org.shipkit:shipkit-auto-version:0.+"
classpath "org.shipkit:shipkit-changelog:0.+"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
}
}

apply plugin: "org.shipkit.single-project"
apply from: "gradle/shipkit.gradle"

task resolveVersion {
description = "Resolves version in the 'version.properties' file for the SBT build."
doLast {
file("version.properties").text = "version=$version"
}
}

task build(type: Exec) {
commandLine "./build.sh"
}

//Performing hard to reverse release operation (git push) as late as possible
gitPush.mustRunAfter build

task clean(type: Exec) {
commandLine "./clean.sh"
}
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ lazy val commonSettings =
v
}.get)
source.close
version.get
version.get.replace(".*", "-SNAPSHOT")
},
crossScalaVersions := Seq(currentScalaVersion, "2.12.12", "2.11.12"),
scalafmtOnCompile := true,
Expand Down
84 changes: 46 additions & 38 deletions gradle/shipkit.gradle
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
shipkit {
gitHub.repository = "mockito/mockito-scala"
gitHub.readOnlyAuthToken = "a0a4c0f41c200f7c653323014d6a72a127764e17"
gitHub.writeAuthToken = System.getenv("GH_WRITE_TOKEN")
apply plugin: "org.shipkit.shipkit-auto-version"
apply plugin: "org.shipkit.shipkit-changelog"
apply plugin: "org.shipkit.shipkit-gh-release"

tasks.named("generateChangelog") {
previousRevision = "v" + project.ext.'shipkit-auto-version.previous-version'
readOnlyToken = "a0a4c0f41c200f7c653323014d6a72a127764e17"
repository = "mockito/mockito-scala"
}

tasks.named("githubRelease") {
def genTask = tasks.named("generateChangelog").get()
dependsOn genTask
repository = genTask.repository
changelog = genTask.outputFile
writeToken = System.getenv("GH_WRITE_TOKEN")
}

//all contents of this directory will be uploaded to Bintray
ext.releaseSpec = fileTree("target/dist")

allprojects {
plugins.withId("org.shipkit.bintray") {

//Bintray configuration is handled by JFrog Bintray Gradle Plugin
//For reference see the official documentation: https://github.com/bintray/gradle-bintray-plugin
bintray {

key = System.getenv("BINTRAY_API_KEY")

pkg {
repo = 'maven'
user = 'szczepiq'
name = 'mockito-scala'
userOrg = 'mockito'
licenses = ['MIT']
labels = ['mocks', 'tdd', 'unit tests']
publish = true //can be changed to 'false' for testing

filesSpec {
from releaseSpec
into '.'
}

version {
mavenCentralSync {
sync = true
user = System.env.NEXUS_TOKEN_USER
password = System.env.NEXUS_TOKEN_PWD
}
}
apply plugin: 'com.jfrog.bintray'

//Bintray configuration is handled by JFrog Bintray Gradle Plugin
//For reference see the official documentation: https://github.com/bintray/gradle-bintray-plugin
bintray {

key = System.getenv("BINTRAY_API_KEY")

pkg {
repo = 'maven'
user = 'szczepiq'
name = 'mockito-scala'
userOrg = 'mockito'
licenses = ['MIT']
labels = ['mocks', 'tdd', 'unit tests']
publish = true // can be changed to 'false' for testing
dryRun = project.hasProperty("bintrayDryRun")

filesSpec {
// all contents of this directory will be uploaded to Bintray
from fileTree("target/dist")
into '.'
}

version {
mavenCentralSync {
sync = false // TODO: true
user = System.env.NEXUS_TOKEN_USER
password = System.env.NEXUS_TOKEN_PWD
}
}
}
}
}
7 changes: 3 additions & 4 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#Version of the produced binaries. This file is intended to be checked-in.
#It will be automatically bumped by release automation.
version=1.16.4
previousVersion=1.16.3
# The version is inferred by shipkit-auto-version Gradle plugin
# More: https://github.com/shipkit/shipkit-auto-version
version=1.16.*

0 comments on commit 3ececd8

Please sign in to comment.