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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
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@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
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 "info@microcks.io"
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.Aspire/obj/Release/net9.0 -bc . -pn Microcks.Aspire -pv ${{ github.event.inputs.version }} -ps Microcks -nsb https://microcks.io
65+ cp ./src/Microcks.Aspire/obj/Release/net9.0/_manifest/spdx_2.2/manifest.spdx.json ./Microcks.Aspire-net9.0.spdx-sbom.json
66+
67+ - name : Publish release with JReleaser
68+ uses : jreleaser/release-action@v2
69+ env :
70+ JRELEASER_PROJECT_VERSION : ${{ github.event.inputs.version }}
71+ JRELEASER_GPG_PASSPHRASE : ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
72+ JRELEASER_GPG_SECRET_KEY : ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
73+ JRELEASER_GPG_PUBLIC_KEY : ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
74+ JRELEASER_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+
76+ # Persist logs
77+ - name : JReleaser release output
78+ if : always()
79+ uses : actions/upload-artifact@v5
80+ with :
81+ name : jreleaser-release
82+ path : |
83+ target/jreleaser/trace.log
84+ target/jreleaser/output.properties
85+
86+ - name : Set next iteration version
87+ run : |
88+ sed -i "s|<VersionPrefix>.*</VersionPrefix>|<VersionPrefix>${{ github.event.inputs.nextVersion }}</VersionPrefix>|" Directory.Build.props
89+ sed -i 's|<!-- \(.*<VersionSuffix>alpha</VersionSuffix>.*\) -->|\1|' Directory.Build.props
90+
91+ - name : Commit, push and tag changes
92+ run : |
93+ git commit -s -m "chore: Setting ALPHA VersionSuffix to ${{ github.event.inputs.nextVersion }}" .
94+ git push origin ${{ github.event.inputs.branch }}
95+
96+
0 commit comments