-
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.
- Loading branch information
Showing
7 changed files
with
144 additions
and
31 deletions.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.gradle | ||
/local.properties | ||
/gradle.properties | ||
.idea | ||
.DS_Store | ||
/build | ||
|
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,22 @@ | ||
language: java | ||
jdk: oraclejdk8 | ||
env: | ||
global: | ||
- secure: dVtOoBPb5R6FxEOvVLmwj8Spq1cRwuJzPj1VVgmTxngl1a7EcoAk7vLHzl/I6qWTZmtx+TA294k22yLnOAUgWzl1W17af/wViy22r94XwRsw4FW2OHkUHmkUG6Q5FjrvZlWLbhuAC9NFZRun8xtZQqSiD7Wb95jxLN5HDARrfZS5ze/XNit5sEkka4X4vqIzH4SXlAlyd4aqUnUtG+orW0V2oSdycP+izmUZBvyzLPpBeVM90Hq6s+CncOHXUYZi8mcG5G44E0JcOm1P9voJPw1mAiRSyqU2ZPY4t9WxeUrHw9p2EfyW1AnmnM8k6Fe1DB9ZD0RB+x5iUaRG+h43yyHuAnMGfYk8uw4JzfhRdf/gxrPJPcEic6VufRgDPBZLFhUqqCzNLNuu+LxNieK8AkS/jd4Ro4XhuDNtGZdkARa2FcUmj3+NY08L0pKJPgx/Sc0IF/TYgZ/99u9KqDPgyESkiV1XkYQU3tVK6CRZcintoTqYZQKJggY3aVDQxtc0LWjI4J6WLp3Y9cJ9qogh2knJ33ekYjv9CmN76ao6qIa+xrMR2pusIFOF1BgAfNGXcOpLiU6agHSBM5d752RAufrO0I6K08LvFPpqe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qO5KSSIF+XOFE32SrXBbucltbeNIN53qtKtLckYKO5gdPi9ROW1aINhwkdIsGNQXuoKsgJiaicz/BnpHIPt+y6djwQE35anxMOe/EGedMjRaEbvo3YHLdIiyaGg3OGHHZkt3xhLSGD84mwzUHIISNGnqOXrNG3gED5M/I7LXRRc/E/PwInZe1PnCqXMVvmfZl15dwVKLWi5zzaQyU2Tmj+XbihUrBbsVLwcz7E6g5zVYI+yo7/lhuJtXF5PprbgqI+7R/PEJ0rGU2mmzIQBP116oM5xc29519TKtX41/fyr6RlKfsroFM0eQ5z0Qxt+hbZdij+qF5qilMuEQ0U798SN8BNLHDD+HuZv52756uyK9gs0rN0BMOSTo6dDweYd7K+YokZ0vOMs+J7JlLjwj/vkLqOSOUyzusoNEQZcIzK5wIjxwTGzpSSxyt9BNBdn9/lILJ1vejkkK+IFqYch0GonDCiK2Mz/cbFW5bZykN+dy0i8/sKVdbnZMLi3wtgL3kKS2iElgFkEifJh+zwJGkuEM/cHRO1qNAAhq9JbXEX25W2QFBDFCag3wQMmUzvfsuI9IfiXqXieYjM0pnFpC3DeYCELHWqeIQXMOai86XDVNT3Ke5Id2dChyMG4WrMpE6yn9gdyc9Vt01AkEkgdNnvaOWyiAhuKJO5ZIGVEg= | ||
|
||
before_install: | ||
- openssl aes-256-cbc -K $encrypted_0c4056e72dfa_key -iv $encrypted_0c4056e72dfa_iv | ||
-in monzo-retrofit/sign.tar.enc -out monzo-retrofit/sign.tar -d | ||
- tar xvf monzo-retrofit/sign.tar -C monzo-retrofit/ | ||
|
||
deploy: | ||
- provider: script | ||
script: ./gradlew uploadArchives closeAndPromoteRepository #uploadArchives depends on the custom task checkArchivesUpload, which checks everything is fine | ||
skip_cleanup: true | ||
on: | ||
tags: true | ||
all_branches: true |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
gradle.properties | ||
secring.gpg | ||
sign.tar | ||
/build |
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 |
---|---|---|
|
@@ -16,9 +16,12 @@ | |
|
||
apply plugin: 'java' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
apply plugin: 'io.codearte.nexus-staging' | ||
|
||
group = 'com.christiangp' | ||
version = '0.1.1-SNAPSHOT' | ||
archivesBaseName = "monzo-retrofit" | ||
version = '0.1.2' | ||
|
||
sourceCompatibility = "1.7" | ||
targetCompatibility = "1.7" | ||
|
@@ -36,22 +39,119 @@ task sourcesJar(type: Jar, dependsOn: classes) { | |
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
classifier = 'javadoc' | ||
from javadoc | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar | ||
} | ||
|
||
// To specify a license in the pom: | ||
install { | ||
repositories.mavenInstaller { | ||
pom.project { | ||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
archives javadocJar, sourcesJar | ||
} | ||
|
||
signing { | ||
required { gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
nexusStaging { | ||
numberOfRetries = 10 | ||
delayBetweenRetriesInMillis = 3000 | ||
} | ||
|
||
task checkReleaseCandidateVersion() { | ||
doLast { | ||
def branchName = System.env.TRAVIS_BRANCH != null ? System.env.TRAVIS_BRANCH : getGitBranchName() | ||
failIfCandidateBranchWithWrongVersion(branchName, "release/", version) | ||
failIfCandidateBranchWithWrongVersion(branchName, "hotfix/", version) | ||
} | ||
|
||
} | ||
|
||
task checkArchivesUpload() { | ||
doLast { | ||
if (version.contains("-SNAPSHOT")) { | ||
System.out.println("Snapshot upload: $version") | ||
return; | ||
} | ||
|
||
System.out.println("Release upload") | ||
//Release or release candidate | ||
def tagName = System.env.TRAVIS_TAG | ||
if (tagName == null) throw new IllegalStateException("Attempting a release from not a tag. Use CI") | ||
|
||
if (tagName != version) { | ||
throw new IllegalArgumentException("The tag name ($tagName) does not match the build version name ($version)") | ||
} | ||
System.out.println("Checks for tag $tagName successful") | ||
} | ||
} | ||
|
||
def ossrh_Username = hasProperty("ossrhUsername") ? ossrhUsername : System.getenv("ossrhUsername"); | ||
def ossrh_Password = hasProperty("ossrhPassword") ? ossrhPassword : System.getenv("ossrhPassword"); | ||
|
||
uploadArchives { | ||
dependsOn checkArchivesUpload | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
authentication(userName: ossrh_Username, password: ossrh_Password) | ||
} | ||
|
||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
authentication(userName: ossrh_Username, password: ossrh_Password) | ||
} | ||
|
||
pom.project { | ||
name 'Monzo Retrofit' | ||
packaging 'jar' | ||
artifactId archivesBaseName | ||
description 'A Retrofit interface for Monzo\'s public API.' | ||
url 'https://github.com/ChristianGarcia/MonzoRetrofit' | ||
|
||
scm { | ||
connection 'scm:git:git://github.com/ChristianGarcia/MonzoRetrofit.git' | ||
developerConnection 'scm:git:ssh://github.com:ChristianGarcia/MonzoRetrofit.git' | ||
url 'https://github.com/ChristianGarcia/MonzoRetrofit/' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'ChristianGarcia' | ||
name 'Christian Garcia' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
compileJava.dependsOn checkReleaseCandidateVersion | ||
|
||
def getGitBranchName() { | ||
// Triple double-quotes for the breaklines | ||
def workingBranch = """git --git-dir=${rootDir}/.git | ||
--work-tree=${rootDir} | ||
rev-parse --abbrev-ref HEAD""".execute().text.trim() | ||
return workingBranch | ||
} | ||
|
||
def static void failIfCandidateBranchWithWrongVersion(branchName, prefix, version) { | ||
if (branchName.indexOf(prefix) == -1) { | ||
return | ||
} | ||
def branchBuildVersion = branchName.substring(branchName.indexOf(prefix) + prefix.length()) | ||
|
||
if (!version.startsWith(branchBuildVersion)) { | ||
throw new IllegalArgumentException("The branch version ($branchBuildVersion) does not match the build version ($version)") | ||
} | ||
} |
Binary file not shown.