From 6f1b01ac545fe6c09e182ebcdb771a34d3aad497 Mon Sep 17 00:00:00 2001 From: Kevin Davis Date: Mon, 21 Dec 2020 19:34:23 -0500 Subject: [PATCH] GH-1246: Configuring Sonatype/Maven Central Deployment (#1334) Configuring Circle CI to deploy to Maven Central. * Locking Snapshot to build only on master * All builds must pass before deploying a snapshot on master --- .circleci/config.yml | 41 ++++++++++++++++++++++++++++++++++++----- .circleci/settings.xml | 39 +++++++++++++++++++++++++++++++++++++++ pom.xml | 6 ++++++ 3 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 .circleci/settings.xml diff --git a/.circleci/config.yml b/.circleci/config.yml index a9bd8c66..108a3449 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,11 +12,6 @@ # the License. # -# Java Maven CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-java/ for more details -# - # our job defaults defaults: &defaults working_directory: ~/feign @@ -37,6 +32,21 @@ defaults: &defaults - run: mvn -o test version: 2.1 + +commands: + configure-gpg: + steps: + - run: + name: 'Configure GPG keys' + command: | + echo -e "$GPG_KEY" | gpg --batch --no-tty --import --yes + nexus-deploy: + steps: + - run: + name: 'Deploy to Sonatype' + command: | + mvn -nsu -s .circleci/settings.xml -P release -pl -:feign-benchmark -DskipTests=true deploy + jobs: jdk8: docker: @@ -53,6 +63,18 @@ jobs: - image: circleci/openjdk:14-buster <<: *defaults + deploy-snapshot: + docker: + - image: circleci/openjdk:8 + steps: + - checkout + - restore_cache: + keys: + - feign-dependencies-{{ checksum "pom.xml" }} + - feign-dependencies- + - configure-gpg + - nexus-deploy + workflows: version: 2 build: @@ -60,3 +82,12 @@ workflows: - jdk8 - jdk11 - jdk14 + - deploy-snapshot: + requires: + - jdk8 + - jdk11 + - jdk14 + context: Sonatype + filters: + branches: + only: master diff --git a/.circleci/settings.xml b/.circleci/settings.xml new file mode 100644 index 00000000..b3b4740a --- /dev/null +++ b/.circleci/settings.xml @@ -0,0 +1,39 @@ + + + + + ossrh + ${env.SONATYPE_USER} + ${env.SONATYPE_PASSWORD} + + + + + ossrh + + true + + + ${env.GPG_PASSPHRASE} + + + + + diff --git a/pom.xml b/pom.xml index da38499e..9776d154 100644 --- a/pom.xml +++ b/pom.xml @@ -795,6 +795,12 @@ sign + + + --pinentry-mode + loopback + + verify