Skip to content

Commit bb4fa6e

Browse files
committed
chore: #118 Add SBOM generation and Jreleaser config
Signed-off-by: Laurent Broudoux <laurent.broudoux@gmail.com>
1 parent 90ca815 commit bb4fa6e

File tree

3 files changed

+200
-1
lines changed

3 files changed

+200
-1
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 "info@microcks.io"
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 Testcontainers
3+
description: Microcks Testcontainers Java library
4+
longDescription: Microcks Testcontainers Java library
5+
copyright: The Microcks Authors
6+
java:
7+
version: 8
8+
9+
signing:
10+
active: ALWAYS
11+
armored: true
12+
13+
assemble:
14+
archive:
15+
microcks-quarkus:
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-testcontainers-{{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: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
</build>
239239
</profile>
240240
<profile>
241-
<id>release</id>
241+
<id>release-old</id>
242242
<build>
243243
<plugins>
244244
<plugin>
@@ -261,5 +261,65 @@
261261
</plugins>
262262
</build>
263263
</profile>
264+
<profile>
265+
<id>release</id>
266+
<build>
267+
<plugins>
268+
<plugin>
269+
<groupId>org.apache.maven.plugins</groupId>
270+
<artifactId>maven-javadoc-plugin</artifactId>
271+
<version>3.4.1</version>
272+
<executions>
273+
<execution>
274+
<id>attach-javadoc</id>
275+
<goals>
276+
<goal>jar</goal>
277+
</goals>
278+
</execution>
279+
</executions>
280+
</plugin>
281+
<plugin>
282+
<groupId>org.apache.maven.plugins</groupId>
283+
<artifactId>maven-source-plugin</artifactId>
284+
<version>3.2.1</version>
285+
<executions>
286+
<execution>
287+
<id>attach-source</id>
288+
<goals>
289+
<goal>jar</goal>
290+
</goals>
291+
</execution>
292+
</executions>
293+
</plugin>
294+
<plugin>
295+
<groupId>org.spdx</groupId>
296+
<artifactId>spdx-maven-plugin</artifactId>
297+
<version>0.7.4</version>
298+
<executions>
299+
<execution>
300+
<id>build-spdx</id>
301+
<phase>package</phase>
302+
<goals>
303+
<goal>createSPDX</goal>
304+
</goals>
305+
</execution>
306+
</executions>
307+
<configuration>
308+
<spdxFile>${project.reporting.outputDirectory}/${project.artifactId}-${project.version}.spdx-sbom.json</spdxFile>
309+
<spdxDocumentNamespace>http://spdx.org/spdxpackages/${project.artifactId}-${project.version}</spdxDocumentNamespace>
310+
</configuration>
311+
</plugin>
312+
<plugin>
313+
<groupId>org.jreleaser</groupId>
314+
<artifactId>jreleaser-maven-plugin</artifactId>
315+
<version>1.15.0</version>
316+
<inherited>false</inherited>
317+
<configuration>
318+
<configFile>jreleaser.yml</configFile>
319+
</configuration>
320+
</plugin>
321+
</plugins>
322+
</build>
323+
</profile>
264324
</profiles>
265325
</project>

0 commit comments

Comments
 (0)