Skip to content

Commit

Permalink
Fix maven-central deployment.
Browse files Browse the repository at this point in the history
  • Loading branch information
daggerok committed Sep 6, 2018
1 parent 3eb0560 commit 6935e6d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 39 deletions.
41 changes: 23 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ script:
bintray101 \
bintray102 \
; do
rm -rf ~/.m2/repository/com/github/daggerok/daggerok-context
rm -rf ~/.gradle/caches/modules-2/files-2.1/com.github.daggerok/daggerok-contex
cd $root/samples/$sample
pwd
./mvnw -U
Expand All @@ -90,6 +92,8 @@ script:
central101 \
central102 \
; do
rm -rf ~/.m2/repository/com/github/daggerok/daggerok-context
rm -rf ~/.gradle/caches/modules-2/files-2.1/com.github.daggerok/daggerok-contex
cd $root/samples/$sample
pwd
./mvnw -U
Expand All @@ -102,29 +106,30 @@ script:
bash ./build/install/$sample/bin/$sample $sample
done
#deploy:
#deploy release artifacts to bintray jcenter and maven central repositories:
- cd ${root}/
- chmod 0600 .gnupg/gpg.conf
#
- test ".${TRAVIS_BRANCH}" = ".master" && echo "deploy drafted release to bintray jcenter"
- test ".${TRAVIS_BRANCH}" != ".release" || echo "deploy drafted release to bintray jcenter"
- test ".${TRAVIS_BRANCH}" != ".release" || mkdir -p ~/.gradle
- test ".${TRAVIS_BRANCH}" != ".release" || echo 'bintrayUser=daggerok' >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" != ".release" || echo "bintrayApiKey=$BINTRAY_API_KEY" >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" != ".release" || ./gradlew clean assemble
- test ".${TRAVIS_BRANCH}" != ".release" || ./gradlew -S bintrayUpload
#
- test ".${TRAVIS_BRANCH}" = ".master" && mkdir -p ~/.gradle
- test ".${TRAVIS_BRANCH}" = ".master" && echo 'bintrayUser=daggerok' >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && echo "bintrayApiKey=$BINTRAY_API_KEY" >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && ./gradlew clean assemble
- test ".${TRAVIS_BRANCH}" = ".master" && ./gradlew -S bintrayUpload
#
- test ".${TRAVIS_BRANCH}" = ".master" && echo "deploy drafted release to maven central"
- test ".${TRAVIS_BRANCH}" != ".release" || echo "deploy drafted release to maven central"
- |
if [ ".${TRAVIS_BRANCH}" = ".release" ]; then
mkdir -p ~/.gradle
echo 'ossrhUsername=daggerok' >> ~/.gradle/gradle.properties
echo "ossrhPassword=$OSSRH_PASSWORD" >> ~/.gradle/gradle.properties
echo "signing.keyId=$SIGNING_KEY_ID" >> ~/.gradle/gradle.properties
echo "signing.password=$SIGNING_PASSWORD" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=$(pwd)/.gnupg/secring.gpg" >> ~/.gradle/gradle.properties
./gradlew clean assemble
./gradlew -Si uploadArchives -Pmaven-central
fi
#
- test ".${TRAVIS_BRANCH}" = ".master" && echo 'ossrhUsername=daggerok' >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && echo "ossrhPassword=$OSSRH_PASSWORD" >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && echo "signing.keyId=$SIGNING_KEY_ID" >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && echo "signing.password=$SIGNING_PASSWORD" >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && echo "signing.secretKeyRingFile=$(pwd)/.gnupg/secring.gpg" >> ~/.gradle/gradle.properties
- test ".${TRAVIS_BRANCH}" = ".master" && echo 'apply from:\\ "$project.projectDir/gradle/maven-central.gradle"' >> build.gradle
- test ".${TRAVIS_BRANCH}" = ".master" && cat build.gradle
- test ".${TRAVIS_BRANCH}" = ".master" && ./gradlew clean assemble
- test ".${TRAVIS_BRANCH}" = ".master" && ./gradlew -Si uploadArchives

before_cache:
- for item in $(find ~/.gradle -name "*.lock");
Expand Down
30 changes: 17 additions & 13 deletions RELEASE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

== gradle (bintray artifactory)

////
.prepare `gradle.properties` file
[source,bash]
----
Expand All @@ -27,13 +28,17 @@ echo 'bintrayApiKey=Bintray.api.key...' >> ~/.gradle/gradle.properties
# Uploaded to 'https://api.bintray.com/content/daggerok/daggerok/daggerok-context/1.0.2/com/github/daggerok/daggerok-context/1.0.2/daggerok-context-1.0.2.jar'.
# Uploaded to 'https://api.bintray.com/content/daggerok/daggerok/daggerok-context/1.0.2/com/github/daggerok/daggerok-context/1.0.2/daggerok-context-1.0.2.pom'.
----
////

go to https://bintray.com/daggerok/daggerok/daggerok-context/

login and publish deployed version to jcenter repository
. update artifact version in build.gradle
. create pull request into release branch
. wait for Travis CI build finish
. login into https://bintray.com/daggerok/daggerok/daggerok-context
. click to publish on 'You have ... unpublished item(s) for this package' note

== gradle (maven central)

////
.prepare `gradle.properties` file
[source,bash]
----
Expand All @@ -45,17 +50,11 @@ echo 'signing.password=Pgp2.password...' >> ~/.gradle/gradle.properties
echo 'signing.secretKeyRingFile=/Users/mak/.gnupg/secring.gpg' >> ~/.gradle/gradle.properties
----
.prepare `build.gradle` file
[source,bash]
----
# uncomment maven-central.gradle file usage in build.gradle:
echo 'apply from: "$project.projectDir/gradle/maven-central.gradle"' >> build.gradle
----

.publish artifact to bintray jcenter
----
./gradlew clean assemble
./gradlew -Si uploadArchives
#./gradlew -Si uploadArchives
./gradlew -Si uploadArchives -Pmaven-central
## output:
# Deploying to https://oss.sonatype.org/service/local/staging/deploy/maven2/
Expand Down Expand Up @@ -101,9 +100,14 @@ echo 'apply from: "$project.projectDir/gradle/maven-central.gradle"' >> build.gr
# Transferring 0K from remote
# Uploaded 0K
----
////

go to https://oss.sonatype.org/#stagingRepositories
. update artifact version in build.gradle
. create pull request into release branch
. wait for Travis CI build finish
. login into https://oss.sonatype.org/#stagingRepositories
. find your deployment, close it, wait a little and release

login and publish deployed version and link:https://central.sonatype.org/pages/releasing-the-deployment.html[follow instructions]
or follow link:https://central.sonatype.org/pages/releasing-the-deployment.html[these] instructions for details

link:https://www.youtube.com/watch?v=b5D2EBjLp40&feature=youtu.be[see for details YouTube: 04 - Accessing OSS-RH - Easy Publishing to Central Repository]
23 changes: 16 additions & 7 deletions VERSIONS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,30 @@
see link:./BINTRAY.adoc[bintray] and link:./JITPACK.adoc[jitpack] READMEs to pickup right version from repository you need...

|===
|bintray jcenter/daggerok|jitpack|minimal JDK support
|bintray jcenter|maven central|jitpack|minimal JDK support

|0.0.1
|0.0.1
|1.0.3
|1.0.3
|1.0.3
|1.5+

|1.0.0
|1.0.0
|1.0.2
|1.0.2
|-
|1.5+

|1.0.1
|1.0.1
|1.0.1
|1.5+

|1.0.2
|1.0.2
|1.0.0
|-
|1.0.0
|1.5+

|0.0.1
|-
|0.0.1
|1.5+
|===
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,7 @@ def getPropOrSystemOrDefault(def propertyName, def systemPropertyName) {

apply from: "$project.projectDir/gradle/maven-publish.gradle"
apply from: "$project.projectDir/gradle/bintray.gradle"
//apply from: "$project.projectDir/gradle/maven-central.gradle"

if (project.hasProperty('maven-central')) {
apply from: "$project.projectDir/gradle/maven-central.gradle"
}
11 changes: 11 additions & 0 deletions src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%gray(%d{yyyy-MM-dd HH:mm:ss.SSS}) %highlight(%-5level) %magenta(%thread{10}) [ %cyan(%-25.25logger{24})] - %boldWhite(%msg%n)</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
</configuration>

0 comments on commit 6935e6d

Please sign in to comment.