Skip to content

Commit 027c67c

Browse files
authored
Merge pull request #44 from entur/release-maven-central-in-ci
Technical upgrades
2 parents 3122d7d + ab36224 commit 027c67c

File tree

3 files changed

+200
-129
lines changed

3 files changed

+200
-129
lines changed

.circleci/config.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ aliases:
1616
-Dsonar.projectName=${CIRCLE_PROJECT_REPONAME} \
1717
-Dsonar.host.url=https://sonarcloud.io \
1818
-Dsonar.login=${ENTUR_SONAR_PASSWORD}
19+
- &release
20+
name: Release
21+
command: |
22+
echo "Start release"
23+
git config --global user.email "circleci@entur.no"
24+
git config --global user.name "circleci"
25+
git checkout master
26+
mvn gitflow:release-start gitflow:release-finish -DskipTests=true -pl gbfs-java-model -Prelease -DpostReleaseGoals=deploy -DargLine='-Prelease -pl gbfs-java-model -DskipTests -s .circleci/settings.xml' -B -s .circleci/settings.xml
27+
- &import_gpg_key
28+
name: Configure GPG private key for signing project artifacts in OSS Sonatype
29+
command: |
30+
echo $SONATYPE_GPG_KEY_BASE64 | base64 --decode | gpg --batch --no-tty --import --yes
1931
2032
jobs:
2133
build:
2234
docker:
23-
- image: cimg/openjdk:11.0
35+
- image: cimg/openjdk:17.0
2436
auth:
2537
username: $DOCKERHUB_LOGIN
2638
password: $DOCKERHUB_PASSWORD
@@ -30,8 +42,9 @@ jobs:
3042
- checkout
3143
- restore_cache:
3244
keys:
33-
- dep-cache-v2-{{ checksum "pom.xml" }}
34-
- dep-cache-v2-
45+
- dep-cache-{{ checksum "pom.xml" }}
46+
# fallback to the most recent cache if there is no exact match for this pom.xml
47+
- dep-cache-
3548
- run:
3649
name: Download Maven settings
3750
command: wget https://raw.githubusercontent.com/entur/circleci-toolbox-image-java11/master/tools/m2/settings.xml -O .circleci/settings.xml
@@ -42,7 +55,7 @@ jobs:
4255
- save_cache:
4356
paths:
4457
- ~/.m2
45-
key: dep-cache-v2-{{ checksum "pom.xml" }}
58+
key: dep-cache-{{ checksum "pom.xml" }}
4659
# Cannot use -o because of snapshot dependencies.
4760
- run: mvn package -s .circleci/settings.xml
4861
- run: *sonar-scan
@@ -62,7 +75,7 @@ jobs:
6275
- target
6376
deploy:
6477
docker:
65-
- image: cimg/openjdk:11.0
78+
- image: cimg/openjdk:17.0
6679
auth:
6780
username: $DOCKERHUB_LOGIN
6881
password: $DOCKERHUB_PASSWORD
@@ -71,14 +84,28 @@ jobs:
7184
steps:
7285
- checkout
7386
- restore_cache:
74-
key: dep-cache-v2-{{ checksum "pom.xml" }}
87+
keys:
88+
- dep-cache-{{ checksum "pom.xml" }}
89+
# fallback to the most recent cache if there is no exact match for this pom.xml
90+
- dep-cache-
7591
- run:
7692
name: Download Maven settings
7793
command: wget https://raw.githubusercontent.com/entur/circleci-toolbox-image-java11/master/tools/m2/settings.xml -O .circleci/settings.xml
7894
- run: *jfrog-login
7995
- run:
80-
name: Maven deploy
81-
command: mvn deploy -s .circleci/settings.xml -DskipTests
96+
name: Refresh cache
97+
command: mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.0:go-offline -s .circleci/settings.xml
98+
- run: mvn install -s .circleci/settings.xml && mvn package -s .circleci/settings.xml -Dmaven.test.skip=true
99+
- persist_to_workspace:
100+
root: ~/project
101+
paths:
102+
- target
103+
- run: *import_gpg_key
104+
- run: *release
105+
- save_cache:
106+
paths:
107+
- ~/.m2
108+
key: dep-cache-{{ checksum "pom.xml" }}
82109
workflows:
83110
version: 2
84111
build_test_deploy:

0 commit comments

Comments
 (0)