Skip to content

Commit 1faff51

Browse files
committed
chore: #46 Adding JRelease and SBOM generation during release
Signed-off-by: Laurent Broudoux <[email protected]>
1 parent 404866c commit 1faff51

File tree

3 files changed

+202
-3
lines changed

3 files changed

+202
-3
lines changed

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: 'Branch to release'
7+
required: true
8+
version:
9+
description: 'Release version'
10+
required: true
11+
nextVersion:
12+
description: 'Next version after release (-SNAPSHOT will be added automatically)'
13+
required: true
14+
jobs:
15+
release:
16+
name: Release
17+
runs-on: ubuntu-latest
18+
permissions:
19+
issues: write
20+
contents: write
21+
deployments: write
22+
id-token: write
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@v4
26+
with:
27+
ssh-key: ${{ secrets.RELEASE_DEPLOY_KEY }}
28+
fetch-depth: 0
29+
ref: ${{ github.event.inputs.branch }}
30+
31+
- name: Set up JDK 17 for x64
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '17'
35+
distribution: 'temurin'
36+
architecture: x64
37+
cache: maven
38+
39+
- name: Set release version
40+
run: mvn -B -q versions:set -DnewVersion=${{ github.event.inputs.version }}
41+
42+
- name: Commit, push and tag changes
43+
run: |
44+
git config user.name "microcks-bot"
45+
git config user.email "[email protected]"
46+
git commit -m "Releasing version ${{ github.event.inputs.version }}" .
47+
git tag ${{ github.event.inputs.version }}
48+
git push origin ${{ github.event.inputs.version }}
49+
50+
- name: Stage release artifacts
51+
run: mvn -B -Prelease clean deploy -DaltDeploymentRepository=local::default::file://`pwd`/target/staging-deploy
52+
53+
- name: Publish package with JReleaser
54+
env:
55+
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
56+
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
57+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
58+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
59+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
60+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
run: mvn -N -Prelease jreleaser:assemble jreleaser:full-release
62+
63+
# Persist logs
64+
- name: JReleaser release output
65+
if: always()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: jreleaser-release
69+
path: |
70+
target/jreleaser/trace.log
71+
target/jreleaser/output.properties
72+
73+
- name: Set next iteration version
74+
run: mvn -B -q versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}-SNAPSHOT
75+
76+
- name: Commit, push and tag changes
77+
run: |
78+
git commit -m "Setting SNAPSHOT version ${{ github.event.inputs.nextVersion }}-SNAPSHOT" .
79+
git push origin ${{ github.event.inputs.branch }}

jreleaser.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
project:
2+
name: Microcks Java Client
3+
description: Microcks Java Client library
4+
longDescription: Java Client for interacting with Microcks API
5+
copyright: The Microcks Authors
6+
java:
7+
version: 17
8+
9+
signing:
10+
active: ALWAYS
11+
armored: true
12+
13+
assemble:
14+
archive:
15+
microcks-java-client:
16+
active: ALWAYS
17+
stereotype: NONE
18+
options:
19+
longFileMode: POSIX
20+
formats:
21+
- ZIP
22+
- TGZ
23+
fileSets:
24+
- input: target/staging-deploy
25+
includes:
26+
- '**/*.*'
27+
28+
files:
29+
active: ALWAYS
30+
artifacts:
31+
- path: 'target/site/microcks-java-client-{{projectVersion}}.spdx-sbom.json'
32+
33+
deploy:
34+
maven:
35+
nexus2:
36+
sonatype:
37+
active: ALWAYS
38+
snapshotSupported: false
39+
url: https://oss.sonatype.org/service/local
40+
snapshotUrl: https://oss.sonatype.org/content/repositories/snapshots
41+
stagingProfileId: c3fae58a8dda9
42+
closeRepository: false
43+
releaseRepository: false
44+
stagingRepositories:
45+
- target/staging-deploy
46+
pomchecker:
47+
failOnWarning: false
48+
failOnError: false
49+
strict: false
50+
51+
release:
52+
github:
53+
overwrite: true
54+
releaseName: '{{tagName}}'
55+
tagName: '{{projectVersion}}'
56+
changelog:
57+
formatted: ALWAYS
58+
preset: conventional-commits
59+
contributors:
60+
format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'

pom.xml

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
<name>Microcks Java Client</name>
1010
<description>Java Client for interacting with Microcks API</description>
11-
<url>http://microcks.github.io</url>
11+
<url>https://microcks.io</url>
1212
<organization>
1313
<name>Microcks</name>
14-
<url>http://microcks.github.io</url>
14+
<url>https://microcks.io</url>
1515
</organization>
1616

1717
<licenses>
@@ -177,7 +177,7 @@
177177

178178
<profiles>
179179
<profile>
180-
<id>release</id>
180+
<id>release-old</id>
181181
<build>
182182
<plugins>
183183
<plugin>
@@ -200,5 +200,65 @@
200200
</plugins>
201201
</build>
202202
</profile>
203+
<profile>
204+
<id>release</id>
205+
<build>
206+
<plugins>
207+
<plugin>
208+
<groupId>org.apache.maven.plugins</groupId>
209+
<artifactId>maven-javadoc-plugin</artifactId>
210+
<version>3.4.1</version>
211+
<executions>
212+
<execution>
213+
<id>attach-javadoc</id>
214+
<goals>
215+
<goal>jar</goal>
216+
</goals>
217+
</execution>
218+
</executions>
219+
</plugin>
220+
<plugin>
221+
<groupId>org.apache.maven.plugins</groupId>
222+
<artifactId>maven-source-plugin</artifactId>
223+
<version>3.2.1</version>
224+
<executions>
225+
<execution>
226+
<id>attach-source</id>
227+
<goals>
228+
<goal>jar</goal>
229+
</goals>
230+
</execution>
231+
</executions>
232+
</plugin>
233+
<plugin>
234+
<groupId>org.spdx</groupId>
235+
<artifactId>spdx-maven-plugin</artifactId>
236+
<version>0.7.4</version>
237+
<executions>
238+
<execution>
239+
<id>build-spdx</id>
240+
<phase>package</phase>
241+
<goals>
242+
<goal>createSPDX</goal>
243+
</goals>
244+
</execution>
245+
</executions>
246+
<configuration>
247+
<spdxFile>${project.reporting.outputDirectory}/${project.artifactId}-${project.version}.spdx-sbom.json</spdxFile>
248+
<spdxDocumentNamespace>http://spdx.org/spdxpackages/${project.artifactId}-${project.version}</spdxDocumentNamespace>
249+
</configuration>
250+
</plugin>
251+
<plugin>
252+
<groupId>org.jreleaser</groupId>
253+
<artifactId>jreleaser-maven-plugin</artifactId>
254+
<version>1.15.0</version>
255+
<inherited>false</inherited>
256+
<configuration>
257+
<configFile>jreleaser.yml</configFile>
258+
</configuration>
259+
</plugin>
260+
</plugins>
261+
</build>
262+
</profile>
203263
</profiles>
204264
</project>

0 commit comments

Comments
 (0)