Skip to content

Commit

Permalink
Update CircleCI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouron committed Mar 14, 2024
1 parent 5a09756 commit a968595
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 149 deletions.
42 changes: 0 additions & 42 deletions .circleci/config.yaml

This file was deleted.

83 changes: 28 additions & 55 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,39 @@
# Base build parameters
base_build: &base_build
working_directory: ~/repo
docker:
- image: circleci/openjdk:8-jdk
environment:
MAVEN_OPTS: -Xmx3200m
version: 2.1

# Base steps for maven project
base_restore_cache: &base_restore_cache
restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
orbs:
maven: circleci/[email protected]

base_save_cache: &base_save_cache
save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
executors:
openjdk8:
docker:
- image: cimg/openjdk:8.0

# Jobs definitions
version: 2
jobs:
build:
<<: *base_build

steps:
- checkout
- *base_restore_cache
- run: mvn dependency:go-offline
- *base_save_cache
# run tests!
- run: mvn clean install

deploy:
<<: *base_build

steps:
- checkout
- *base_restore_cache
- run: mvn dependency:go-offline
- *base_save_cache
# Import key in GPG
- run: echo $GPG_SECRET_KEY | base64 --decode | $GPG_EXECUTABLE --batch --import
# Deploy to sonatype
- run: mvn clean deploy -DskipTests -DdeployTo=sonatype --settings .circleci/settings.xml

# Workflow definitions
workflows:
version: 2
deploy_sonatype:
build-and-deploy:
jobs:
- build
# If we are on master or a release branch, we deploy directly to sonatype. Release version will still need manual
# approval via sonatype UI: https://oss.sonatype.org/#stagingRepositories
- deploy:
context: org-global
- maven/test:
name: build
executor: openjdk8
filters:
branches:
only:
- master
- /release\/.*/
settings_file: .circleci/m2-settings.xml
verify_dependencies: false
- maven/test:
name: deploy
executor: openjdk8
requires:
- build
context:
- org-global
- cloudsoft-artifactory
filters:
branches:
only:
- master
- /^release\/.*$/
- /release\/.*/
settings_file: .circleci/m2-settings.xml
command: deploy -DskipTests -P cloudsoft-release
verify_dependencies: false
42 changes: 42 additions & 0 deletions .circleci/m2-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>cloudsoft-deploy-artifactory-snapshot</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>cloudsoft-deploy-artifactory-release</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>

<server>
<id>cloudsoft-snapshots</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>cloudsoft-releases</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>cloudsoft-artifactory-repo</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>

<server>
<id>sonatype-nexus-staging</id>
<username>${env.SONATYPE_USER}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.SONATYPE_USER}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
49 changes: 0 additions & 49 deletions .circleci/settings.xml

This file was deleted.

28 changes: 25 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<buildnumber-maven-plugin.version>1.4</buildnumber-maven-plugin.version>
<maven-bundle-plugin.version>3.3.0</maven-bundle-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-gpg-plugin.version>3.2.0</maven-gpg-plugin.version>
</properties>

<scm>
Expand Down Expand Up @@ -159,7 +160,7 @@

<profiles>
<profile>
<id>sonatype-nexus-repo</id>
<id>sonatype-release</id>
<activation>
<property>
<name>deployTo</name>
Expand Down Expand Up @@ -194,8 +195,8 @@
<goal>sign</goal>
</goals>
<configuration>
<secretKeyring>${gpg.secret.key}</secretKeyring>
<passphrase>${gpg.passphrase}</passphrase>
<secretKeyring>${env.GPG_SECRET_KEY}</secretKeyring>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
Expand All @@ -207,6 +208,27 @@
</plugins>
</build>
</profile>
<profile>
<id>cloudsoft-release</id>
<activation>
<property>
<name>brooklyn.deployTo</name>
<value>cloudsoftArtifactory</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>cloudsoft-deploy-artifactory-release</id>
<name>Cloudsoft Artifactory libs-release-local repo</name>
<url>https://artifactory.cloudsoftcorp.com/artifactory/libs-release-local/</url>
</repository>
<snapshotRepository>
<id>cloudsoft-deploy-artifactory-snapshot</id>
<name>Cloudsoft Artifactory libs-snapshot-local repo</name>
<url>https://artifactory.cloudsoftcorp.com/artifactory/libs-snapshot-local/</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>

</project>

0 comments on commit a968595

Please sign in to comment.