Skip to content

Commit a3dff87

Browse files
committed
Enhance GitHub Actions workflow by adding code checkout step, calculating SHA256 checksums for release files, and extracting release notes from CHANGELOG. The release notes now include checksums for better transparency.
1 parent 861f258 commit a3dff87

File tree

1 file changed

+57
-6
lines changed

1 file changed

+57
-6
lines changed

.github/workflows/build.yml

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ jobs:
211211
runs-on: ubuntu-22.04
212212

213213
steps:
214+
- name: Checkout code
215+
uses: actions/checkout@v2
216+
214217
- name: Get version
215218
shell: bash
216219
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
@@ -220,18 +223,66 @@ jobs:
220223
with:
221224
path: artifacts
222225

223-
- name: Prepare release files
226+
- name: Calculate SHA256 checksums
224227
run: |
225-
cd artifacts
226-
echo "Contents of artifacts directory:"
227-
ls -la
228-
echo "Contents of subdirectories:"
229-
ls -la */
228+
mkdir -p checksums
229+
for file in artifacts/CursorFreeVIP_${{ env.VERSION }}_windows.exe/CursorFreeVIP_${{ env.VERSION }}_windows.exe \
230+
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_arm64/CursorFreeVIP_${{ env.VERSION }}_mac_arm64 \
231+
artifacts/CursorFreeVIP_${{ env.VERSION }}_linux_x64/CursorFreeVIP_${{ env.VERSION }}_linux_x64 \
232+
artifacts/CursorFreeVIP_${{ env.VERSION }}_linux_arm64/CursorFreeVIP_${{ env.VERSION }}_linux_arm64 \
233+
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_intel/CursorFreeVIP_${{ env.VERSION }}_mac_intel
234+
do
235+
if [ -f "$file" ]; then
236+
filename=$(basename $file)
237+
sha256sum "$file" | cut -d ' ' -f 1 > checksums/${filename}.sha256
238+
echo "${filename}: $(cat checksums/${filename}.sha256)" >> checksums/all_checksums.txt
239+
else
240+
echo "Warning: File $file not found"
241+
fi
242+
done
243+
cat checksums/all_checksums.txt
244+
245+
- name: Extract release notes from CHANGELOG
246+
run: |
247+
version_pattern="## v${{ env.VERSION }}"
248+
next_version_pattern="## v"
249+
250+
# Find the start line number of the current version
251+
start_line=$(grep -n "$version_pattern" CHANGELOG.md | head -1 | cut -d: -f1)
252+
253+
if [ -z "$start_line" ]; then
254+
echo "Error: Version ${{ env.VERSION }} not found in CHANGELOG.md"
255+
exit 1
256+
fi
230257
258+
# Find the line number of the next version
259+
next_version_line=$(tail -n +$((start_line + 1)) CHANGELOG.md | grep -n "$next_version_pattern" | head -1 | cut -d: -f1)
260+
261+
if [ -z "$next_version_line" ]; then
262+
# If there's no next version, get to the end of the file
263+
changelog_content=$(tail -n +$start_line CHANGELOG.md)
264+
else
265+
# Extract content between current version and next version
266+
end_line=$((start_line + next_version_line - 1))
267+
changelog_content=$(sed -n "${start_line},${end_line}p" CHANGELOG.md)
268+
fi
269+
270+
# Create release notes file
271+
{
272+
echo "$changelog_content"
273+
echo ""
274+
echo "## SHA256 Checksums"
275+
cat checksums/all_checksums.txt
276+
} > release_notes.md
277+
278+
# Display release notes for debugging
279+
cat release_notes.md
280+
231281
- name: Create Release
232282
uses: softprops/action-gh-release@v1
233283
with:
234284
tag_name: v${{ env.VERSION }}
285+
body_path: release_notes.md
235286
files: |
236287
artifacts/CursorFreeVIP_${{ env.VERSION }}_windows.exe/CursorFreeVIP_${{ env.VERSION }}_windows.exe
237288
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_arm64/CursorFreeVIP_${{ env.VERSION }}_mac_arm64

0 commit comments

Comments
 (0)