Skip to content

Commit c2f2a91

Browse files
committed
#183: Fixed multi module releases
1 parent 4e3e452 commit c2f2a91

File tree

5 files changed

+82
-150
lines changed

5 files changed

+82
-150
lines changed

.circleci/config.yml

Lines changed: 38 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,56 @@
11
version: 2.1
22

3-
executors:
4-
maven-executor:
5-
docker:
6-
- image: circleci/openjdk:8u171-jdk
3+
orbs:
4+
github-maven-deploy: github-maven-deploy/github-maven-deploy@dev:22
75

8-
jobs:
6+
mvn-build-test-command: &mvn-build-test-command
7+
mvn-build-test-command: mvn verify -DexcludeLiveServerTests=true
98

10-
build-and-test:
11-
executor: maven-executor
12-
13-
steps:
14-
- checkout
15-
- restore_cache:
16-
key: simple-java-mail-{{ checksum ".circleci/config.yml" }}
17-
- run:
18-
command: mvn verify -DexcludeLiveServerTests=true
19-
- save_cache:
20-
paths:
21-
- ~/.m2
22-
key: simple-java-mail-{{ checksum ".circleci/config.yml" }}
23-
- persist_to_workspace:
24-
root: .
25-
paths:
26-
- .
27-
- run:
28-
shell: /bin/bash -eo pipefail -O globstar
29-
command: |
30-
mkdir -p artifacts/cli artifacts/coverage artifacts/junit artifacts/javadoc
31-
cp **/target/*.jar artifacts/
32-
cp modules/cli-module/target/*standalone* artifacts/cli/
33-
cp -a target/apidocs/. artifacts/javadoc/
34-
cp -a modules/jacoco-aggregator-module/target/site/jacoco-aggregate/. artifacts/coverage/
35-
cp -a **/target/surefire-reports/. artifacts/junit
36-
- store_artifacts:
37-
path: artifacts
38-
- store_test_results:
39-
path: artifacts/junit
40-
41-
deploy-patch-version:
42-
executor: maven-executor
43-
steps:
44-
- deploy:
45-
versioncommand: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} versions:commit
46-
47-
deploy-minor-version:
48-
executor: maven-executor
49-
steps:
50-
- deploy:
51-
versioncommand: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion} versions:commit
52-
53-
deploy-major-version:
54-
executor: maven-executor
55-
steps:
56-
- deploy:
57-
versioncommand: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.nextMajorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} versions:commit
58-
59-
60-
commands:
61-
deploy:
62-
parameters:
63-
versioncommand:
64-
type: string
65-
steps:
66-
- attach_workspace:
67-
at: .
68-
- restore_cache:
69-
key: simple-java-mail-{{ checksum ".circleci/config.yml" }}
70-
- run:
71-
command: |
72-
echo "Starting new release..."
73-
<< parameters.versioncommand >>
74-
MVN_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
75-
echo "Releasing version ${MVN_VERSION}..."
76-
# mvn -s .circleci/maven-release-settings.xml clean deploy nexus-staging:release -DdeployAtEnd=true -DperformRelease=true -DskipTests
77-
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
78-
# git commit -am "released ${MVN_VERSION}" && git push
79-
echo "Succesfully released ${MVN_VERSION}"
9+
mvn-collect-artifacts-command: &mvn-collect-artifacts-command
10+
mvn-collect-artifacts-command: |
11+
mkdir -p artifacts/cli artifacts/coverage artifacts/junit artifacts/javadoc
12+
cp **/target/*.jar artifacts/
13+
cp modules/cli-module/target/*standalone* artifacts/cli/
14+
cp -a target/apidocs/. artifacts/javadoc/
15+
cp -a modules/jacoco-aggregator-module/target/site/jacoco-aggregate/. artifacts/coverage/
16+
cp -a **/target/surefire-reports/. artifacts/junit
8017
18+
mvn-deploy-command: &mvn-deploy-command
19+
mvn-deploy-command: mvn -s .circleci/maven-release-settings.xml clean deploy -DdeployAtEnd=true -DperformRelease=true -DskipTests -Dspotbugs.skip=true
20+
context: RELEASE_PROFILE_BBOTTEMA
8121

8222
workflows:
8323
workflow:
8424
jobs:
85-
- build-and-test
86-
- approve-deploy-patch-version:
25+
- github-maven-deploy/build-and-test:
26+
<<: *mvn-build-test-command
27+
<<: *mvn-collect-artifacts-command
28+
filters:
29+
branches:
30+
only: master
31+
32+
- github-maven-deploy/approve-deploy-patch-version:
8733
type: approval
8834
requires:
89-
- build-and-test
90-
- approve-deploy-minor-version:
35+
- github-maven-deploy/build-and-test
36+
- github-maven-deploy/approve-deploy-minor-version:
9137
type: approval
9238
requires:
93-
- build-and-test
94-
- approve-deploy-major-version:
39+
- github-maven-deploy/build-and-test
40+
- github-maven-deploy/approve-deploy-major-version:
9541
type: approval
9642
requires:
97-
- build-and-test
98-
- deploy-patch-version:
43+
- github-maven-deploy/build-and-test
44+
45+
- github-maven-deploy/deploy-patch-version:
9946
requires:
100-
- approve-deploy-patch-version
101-
- deploy-minor-version:
47+
- github-maven-deploy/approve-deploy-patch-version
48+
<<: *mvn-deploy-command
49+
- github-maven-deploy/deploy-minor-version:
10250
requires:
103-
- approve-deploy-minor-version
104-
- deploy-major-version:
51+
- github-maven-deploy/approve-deploy-minor-version
52+
<<: *mvn-deploy-command
53+
- github-maven-deploy/deploy-major-version:
10554
requires:
106-
- approve-deploy-major-version
55+
- github-maven-deploy/approve-deploy-major-version
56+
<<: *mvn-deploy-command

.gitlab-ci.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

how to release.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@ gpg --allow-secret-key-import --import <keyring>.gpg
77

88
That, or you can install one of the binaries to import the key, from here: https://www.gnupg.org/download/index.html
99

10+
To import the keyring in a CI/CD environment (CircleCI, Azure Devops, Bamboo, Jenkins etc.), you need to import the keyring
11+
externally (or us a private Repo). Alternatively you can import the ASCII export of the key configured as a property secret
12+
so you can ECHO it to a file during the build. Once exposed as file, you can use it to sign:
13+
14+
To generate the ASCII export of a key so you can store it a secret property in your build environment:
15+
- gpg --no-default-keyring --armor --secret-keyring ./secring.gpg --keyring ./pubring.gpg --export-secret-key USER > secring.gpg.asc
16+
- sed ':a;N;$!ba;s/\n/\\n/g' secring.gpg.asc, OR
17+
- base64 encode the text
18+
19+
To be able to have your CI/CD script also commit the new version, you need to add github.com's official host finger print.
20+
- https://serverfault.com/a/701637/157338
21+
- https://discuss.circleci.com/t/error-sending-to-agent-inappropriate-ioctl-for-device/17465/2
22+
- https://medium.com/@Joachim8675309/generating-gpg-key-files-cc447431415a
23+
- http://frankiesardo.github.io/posts/2015-04-19-automate-everything-with-circleci.html
24+
- https://github.com/toknapp/arweave4s/blob/master/.circleci/config.yml
25+
- https://serverfault.com/questions/447028/non-interactive-git-clone-ssh-fingerprint-prompt
26+
- https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use
27+
1028
To release through CI/CD pipeline in CircleCI
1129

1230
1. update release notes and github readme page and push changes

pom.xml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
<artifactId>maven-master-project</artifactId>
88
<packaging>pom</packaging>
99
<version>6.0.0.beta-SNAPSHOT.2</version>
10-
10+
1111
<name>Simple Java Mail - Maven master project</name>
12+
<description>Simple Java Mail - Maven master project</description>
1213
<url>http://www.simplejavamail.org/</url>
13-
14+
1415
<properties>
1516
<java.version>1.7</java.version>
1617
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -328,24 +329,29 @@
328329
</property>
329330
</activation>
330331
<build>
331-
<pluginManagement>
332-
<plugins>
333-
<plugin>
334-
<groupId>org.apache.maven.plugins</groupId>
335-
<artifactId>maven-gpg-plugin</artifactId>
336-
<version>1.5</version>
337-
<executions>
338-
<execution>
339-
<id>sign-artifacts</id>
340-
<phase>verify</phase>
341-
<goals>
342-
<goal>sign</goal>
343-
</goals>
344-
</execution>
345-
</executions>
346-
</plugin>
347-
</plugins>
348-
</pluginManagement>
332+
<plugins>
333+
<plugin>
334+
<groupId>org.apache.maven.plugins</groupId>
335+
<artifactId>maven-gpg-plugin</artifactId>
336+
<version>1.5</version>
337+
<executions>
338+
<execution>
339+
<id>sign-artifacts</id>
340+
<phase>verify</phase>
341+
<goals>
342+
<goal>sign</goal>
343+
</goals>
344+
<!-- fixes tty error under linux -->
345+
<configuration>
346+
<gpgArguments>
347+
<arg>--pinentry-mode</arg>
348+
<arg>loopback</arg>
349+
</gpgArguments>
350+
</configuration>
351+
</execution>
352+
</executions>
353+
</plugin>
354+
</plugins>
349355
</build>
350356
</profile>
351357

0 commit comments

Comments
 (0)