-
Notifications
You must be signed in to change notification settings - Fork 4
164 lines (146 loc) · 6.19 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (146 loc) · 6.19 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Create Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag (e.g., v1.0.0)'
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
- name: Pull LFS files
run: git lfs pull
- name: Determine release tag
id: get_tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.release_tag }}" >> $GITHUB_OUTPUT
else
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Create architecture-specific zip files for tools
run: |
cd output
for arch in */; do
if [ -d "$arch" ]; then
arch_name="${arch%/}"
echo "Creating tools zip for $arch_name..."
# Check if the directory has any files
if [ "$(ls -A "$arch")" ]; then
zip -r "../stheno-toolkit-${arch_name}.zip" "$arch_name"
else
echo "Skipping empty directory: $arch_name"
fi
fi
done
cd ..
echo "Created the following tool zip files:"
ls -la stheno-toolkit-*.zip 2>/dev/null || echo "No tool zip files created!"
- name: Create preload library zip files
run: |
if [ -d "output-preload" ]; then
cd output-preload
# Create combined zip with both glibc and musl
echo "Creating combined preload libraries zip..."
zip -r "../stheno-preload-libraries-all.zip" .
# Create libc-specific zips
for libc in glibc musl; do
if [ -d "$libc" ]; then
echo "Creating $libc preload libraries zip..."
zip -r "../stheno-preload-libraries-${libc}.zip" "$libc"
fi
done
cd ..
echo "Created the following preload library zip files:"
ls -la stheno-preload-libraries-*.zip 2>/dev/null || echo "No preload library zip files created!"
else
echo "No preload libraries found to package"
fi
- name: Generate release notes
id: release_notes
run: |
TAG="${{ steps.get_tag.outputs.tag }}"
echo "## Stheno Embedded Toolkit Release $TAG" > release_notes.md
echo "" >> release_notes.md
# Get the previous tag for comparison
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
# Add what's new section
echo "### What's New" >> release_notes.md
if [ -n "$PREV_TAG" ]; then
echo "" >> release_notes.md
# Get commit messages between tags
git log --pretty=format:"- %s" $PREV_TAG..HEAD >> release_notes.md
echo "" >> release_notes.md
echo "" >> release_notes.md
# Show changed files summary
echo "### Changed Files" >> release_notes.md
echo "" >> release_notes.md
git diff --stat $PREV_TAG..HEAD | tail -n 1 >> release_notes.md
echo "" >> release_notes.md
else
echo "Initial release" >> release_notes.md
fi
echo "" >> release_notes.md
echo "### Downloads" >> release_notes.md
echo "" >> release_notes.md
echo "#### Security Tools" >> release_notes.md
echo "Download the toolkit zip file for your target architecture. All binaries are statically linked with musl libc." >> release_notes.md
echo "" >> release_notes.md
echo "#### Preload Libraries" >> release_notes.md
echo "- \`stheno-preload-libraries-all.zip\` - All preload libraries (glibc and musl)" >> release_notes.md
echo "- \`stheno-preload-libraries-glibc.zip\` - glibc-only preload libraries" >> release_notes.md
echo "- \`stheno-preload-libraries-musl.zip\` - musl-only preload libraries" >> release_notes.md
echo "" >> release_notes.md
echo "Preload libraries include: shell-env, shell-helper, shell-bind, shell-reverse, shell-fifo, and libdesock" >> release_notes.md
echo "" >> release_notes.md
echo "For a complete list of tools and supported architectures, see the [README](https://github.com/${{ github.repository }}/blob/main/README.md)." >> release_notes.md
- name: Create Release and Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create the release using gh CLI
gh release create ${{ steps.get_tag.outputs.tag }} \
--title "Stheno Embedded Toolkit ${{ steps.get_tag.outputs.tag }}" \
--notes-file release_notes.md \
--repo ${{ github.repository }}
# Upload all toolkit zip files
for zip in stheno-toolkit-*.zip; do
if [ -f "$zip" ]; then
echo "Uploading $zip..."
gh release upload ${{ steps.get_tag.outputs.tag }} "$zip" \
--clobber \
--repo ${{ github.repository }}
fi
done
# Upload all preload library zip files
for zip in stheno-preload-libraries-*.zip; do
if [ -f "$zip" ]; then
echo "Uploading $zip..."
gh release upload ${{ steps.get_tag.outputs.tag }} "$zip" \
--clobber \
--repo ${{ github.repository }}
fi
done
- name: Generate SHA256 checksums
run: |
sha256sum stheno-toolkit-*.zip stheno-preload-libraries-*.zip > checksums.sha256 2>/dev/null || true
if [ -f checksums.sha256 ] && [ -s checksums.sha256 ]; then
gh release upload ${{ steps.get_tag.outputs.tag }} checksums.sha256 \
--clobber \
--repo ${{ github.repository }}
else
echo "No files to checksum"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}