-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 3.09 KB
/
Copy pathmodule-gh-create-release.yml
File metadata and controls
104 lines (88 loc) · 3.09 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright 2026 The MathWorks, Inc.
name: 'Module: GitHub Release'
on:
workflow_call:
inputs:
release_files_pattern:
required: true
type: string
release_tag:
required: true
type: string
release_title:
required: true
type: string
prerelease:
required: true
type: boolean
generate_attestations:
required: true
type: boolean
jobs:
gh-release:
name: Publish GH Release
runs-on: ubuntu-latest
permissions:
contents: write # Required to create the release
id-token: write # Required for attestation signing
attestations: write # Required to store attestations
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Download All Artifacts
uses: actions/download-artifact@v5
with:
path: ./artifacts
- name: Archive and Zip Artifacts
id: files
shell: bash
run: |
mkdir -p release_assets
find ./artifacts -type f -name "${{ inputs.release_files_pattern }}" -exec mv {} ./artifacts/ \;
VERSIONS=$(ls ./artifacts | grep -oE '^R20[0-9]{2}[ab]' | sort | uniq)
if [ -z "$VERSIONS" ]; then
echo "::error::No version-prefixed artifacts found matching pattern 'R20XX[ab]*' in ./artifacts/"
echo "Contents of artifacts directory:"
ls -la ./artifacts/
exit 1
fi
echo "Found versions: $VERSIONS"
ls artifacts
for VER in $VERSIONS; do
echo "Zipping artifacts for $VER..."
zip -j "release_assets/${VER}-artifacts.zip" ./artifacts/${VER}*
done
echo "Prepared Zips:"
ls -l release_assets/
- name: Generate Artifact Attestation
if: inputs.generate_attestations
id: attest
uses: actions/attest-build-provenance@v3
with:
subject-path: "release_assets/*.zip"
- name: Generate Body Text
id: body
shell: bash
env:
ATTESTATION_URL: ${{ steps.attest.outputs.attestation-url }}
run: |
TEXT="## Automated Build Release"
TEXT="${TEXT}\n\n**Build Tag:** \`${{ inputs.release_tag }}\`"
TEXT="${TEXT}\n**Date:** $(date)"
if [[ -n "$ATTESTATION_URL" ]]; then
TEXT="${TEXT}\n\n### 🔐 Security Attestations"
TEXT="${TEXT}\nThis release includes SLSA provenance attestations verified by GitHub."
TEXT="${TEXT}\n- [View Attestation Details]($ATTESTATION_URL)"
fi
echo "release_body<<EOF" >> $GITHUB_OUTPUT
echo -e "$TEXT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.release_tag }}
name: ${{ inputs.release_title || inputs.release_tag }}
body: ${{ steps.body.outputs.release_body }}
files: release_assets/*.zip
prerelease: ${{ inputs.prerelease }}
fail_on_unmatched_files: true