Skip to content

Commit 6f226b2

Browse files
authored
chore: #84 Adding release process with SBOM gen (#85)
* chore: #84 Adding release process with SBOM gen Signed-off-by: Laurent Broudoux <[email protected]> * chore: #84 Fixing commit messages to add chore: Signed-off-by: Laurent Broudoux <[email protected]> --------- Signed-off-by: Laurent Broudoux <[email protected]>
1 parent e31521a commit 6f226b2

File tree

3 files changed

+124
-1
lines changed

3 files changed

+124
-1
lines changed

.github/workflows/release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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 (ALPHA VersionSuffix 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@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
26+
with:
27+
ssh-key: ${{ secrets.RELEASE_DEPLOY_KEY }}
28+
lfs: true
29+
fetch-depth: 0
30+
ref: ${{ github.event.inputs.branch }}
31+
32+
- name: 🛠️ Setup .NET
33+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #v4.3.1
34+
with:
35+
global-json-file: global.json
36+
37+
- name: Set release version
38+
run: |
39+
# Comment alpha version suffix and force version prefix to release version
40+
sed -i '/<VersionSuffix>alpha<\/VersionSuffix>/ s|.*|<!-- & -->|' Directory.Build.props
41+
sed -i "s|<VersionPrefix>.*</VersionPrefix>|<VersionPrefix>${{ github.event.inputs.version }}</VersionPrefix>|" Directory.Build.props
42+
43+
- name: 🔧 Restore .NET Tools
44+
run: dotnet tool restore
45+
46+
- name: 🔧 Restore dependencies
47+
run: dotnet restore
48+
49+
- name: 🏗 Build
50+
run: dotnet build --configuration Release --no-restore
51+
52+
- name: Commit, push and tag changes
53+
run: |
54+
git config user.name "microcks-bot"
55+
git config user.email "[email protected]"
56+
git commit -S -m "chore: Releasing version ${{ github.event.inputs.version }}" .
57+
git tag ${{ github.event.inputs.version }}
58+
git push origin ${{ github.event.inputs.version }}
59+
60+
- name: Generate SBOM
61+
run: |
62+
curl -Lo $RUNNER_TEMP/sbom-tool https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
63+
chmod +x $RUNNER_TEMP/sbom-tool
64+
$RUNNER_TEMP/sbom-tool generate -b ./src/Microcks.Testcontainers/obj/Release/net6.0 -bc . -pn Microcks.Testcontainers -pv ${{ github.event.inputs.version }} -ps Microcks -nsb https://microcks.io
65+
$RUNNER_TEMP/sbom-tool generate -b ./src/Microcks.Testcontainers/obj/Release/net8.0 -bc . -pn Microcks.Testcontainers -pv ${{ github.event.inputs.version }} -ps Microcks -nsb https://microcks.io
66+
cp ./src/Microcks.Testcontainers/obj/Release/net6.0/_manifest/spdx_2.2/manifest.spdx.json ./Microcks.Testcontainers-net6.0.spdx-sbom.json
67+
cp ./src/Microcks.Testcontainers/obj/Release/net8.0/_manifest/spdx_2.2/manifest.spdx.json ./Microcks.Testcontainers-net8.0.spdx-sbom.json
68+
69+
- name: Publish release with JReleaser
70+
uses: jreleaser/release-action@v2
71+
env:
72+
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
73+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
74+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
75+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
76+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
78+
# Persist logs
79+
- name: JReleaser release output
80+
if: always()
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: jreleaser-release
84+
path: |
85+
target/jreleaser/trace.log
86+
target/jreleaser/output.properties
87+
88+
- name: Set next iteration version
89+
run: |
90+
sed -i "s|<VersionPrefix>.*</VersionPrefix>|<VersionPrefix>${{ github.event.inputs.nextVersion }}</VersionPrefix>|" Directory.Build.props
91+
sed -i 's|<!-- \(.*<VersionSuffix>alpha</VersionSuffix>.*\) -->|\1|' Directory.Build.props
92+
93+
- name: Commit, push and tag changes
94+
run: |
95+
git commit -S -m "chore: Setting ALPHA VersionSuffix to ${{ github.event.inputs.nextVersion }}" .
96+
git push origin ${{ github.event.inputs.branch }}
97+
98+

jreleaser.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
project:
2+
name: Microcks Testcontainers
3+
description: Microcks Testcontainers .NET library
4+
longDescription: Microcks Testcontainers .NET library
5+
copyright: The Microcks Authors
6+
7+
signing:
8+
active: ALWAYS
9+
armored: true
10+
11+
files:
12+
active: ALWAYS
13+
artifacts:
14+
- path: './Microcks.Testcontainers-net6.0.spdx-sbom.json'
15+
- path: './Microcks.Testcontainers-net8.0.spdx-sbom.json'
16+
17+
release:
18+
github:
19+
overwrite: true
20+
releaseName: '{{tagName}}'
21+
tagName: '{{projectVersion}}'
22+
changelog:
23+
formatted: ALWAYS
24+
preset: conventional-commits
25+
contributors:
26+
format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'

src/Microcks.Testcontainers/Microcks.Testcontainers.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<PropertyGroup>
33
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
44
<LangVersion>latest</LangVersion>
5-
65
<GenerateSBOM>true</GenerateSBOM>
76
</PropertyGroup>
87
<ItemGroup>

0 commit comments

Comments
 (0)