-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (77 loc) · 2.79 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (77 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Release
on:
push:
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: write
id-token: write
attestations: write
artifact-metadata: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Setup Java
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
with:
distribution: temurin
java-version: 21
cache: maven
- name: Build and verify
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
run: bash ./mvnw -q verify
- name: Generate checksums
run: |
: > target/checksums.txt
for artifact in target/javasoundrecorder-*-all.jar target/javasoundrecorder-*-sbom.json target/javasoundrecorder-*-sbom.xml; do
[ -e "$artifact" ] || continue
sha256sum "$artifact" | sed 's# target/# #' >> target/checksums.txt
done
cat target/checksums.txt
- name: Verify SBOM
run: |
if ! compgen -G "target/javasoundrecorder-*-sbom.json" > /dev/null && ! compgen -G "target/javasoundrecorder-*-sbom.xml" > /dev/null; then
echo "SBOM not generated."
exit 1
fi
- name: Resolve release artifact paths
id: artifacts
run: |
jar="$(find target -maxdepth 1 -type f -name 'javasoundrecorder-*-all.jar' -print -quit)"
sbom_json="$(find target -maxdepth 1 -type f -name 'javasoundrecorder-*-sbom.json' -print -quit)"
if [ -z "$jar" ] || [ -z "$sbom_json" ]; then
echo "Required release artifact not found."
exit 1
fi
echo "jar=$jar" >> "$GITHUB_OUTPUT"
echo "sbom_json=$sbom_json" >> "$GITHUB_OUTPUT"
- name: Generate provenance attestations
uses: actions/attest@a1948c3f048ba23858d222213b7c278aabede763 # v4.1.1
with:
subject-checksums: target/checksums.txt
- name: Generate SBOM attestation
uses: actions/attest@a1948c3f048ba23858d222213b7c278aabede763 # v4.1.1
with:
subject-path: ${{ steps.artifacts.outputs.jar }}
sbom-path: ${{ steps.artifacts.outputs.sbom_json }}
- name: Upload release artifact
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
with:
files: |
target/javasoundrecorder-*-all.jar
target/javasoundrecorder-*-sbom.json
target/javasoundrecorder-*-sbom.xml
target/checksums.txt
draft: false
prerelease: false