Skip to content

Commit 8b6e6aa

Browse files
committed
Add automatic release notes generation and new release creation option
1 parent 5f140ba commit 8b6e6aa

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

.github/workflows/prebuild.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
required: false
1010
type: string
1111
default: 'v5.0.0'
12+
create_release:
13+
description: 'Create new release if it doesn\'t exist'
14+
required: false
15+
type: boolean
16+
default: true
1217

1318
# push:
1419
# branches: [n_api, master]
@@ -235,7 +240,13 @@ jobs:
235240
236241
# Check if release exists
237242
echo "Checking if release exists..."
238-
gh release view "${{ github.event.inputs.release_tag }}" || echo "Release not found!"
243+
if gh release view "${{ github.event.inputs.release_tag }}" >/dev/null 2>&1; then
244+
echo "Release ${{ github.event.inputs.release_tag }} exists"
245+
RELEASE_EXISTS=true
246+
else
247+
echo "Release ${{ github.event.inputs.release_tag }} not found"
248+
RELEASE_EXISTS=false
249+
fi
239250
240251
# List all releases for debugging
241252
echo "Available releases:"
@@ -248,15 +259,32 @@ jobs:
248259
# List files to upload
249260
echo "Files to upload:"
250261
ls -la upload-staging/
262+
FILE_COUNT=$(ls upload-staging/*.tar.gz 2>/dev/null | wc -l)
263+
echo "Total files to upload: $FILE_COUNT"
251264
252-
# Upload each file to the release
253-
cd upload-staging
254-
for file in *.tar.gz; do
255-
echo "Uploading $file..."
256-
gh release upload "${{ github.event.inputs.release_tag }}" "$file" --clobber
257-
done
265+
if [ "$RELEASE_EXISTS" = "true" ]; then
266+
# Upload to existing release
267+
cd upload-staging
268+
for file in *.tar.gz; do
269+
echo "Uploading $file..."
270+
gh release upload "${{ github.event.inputs.release_tag }}" "$file" --clobber
271+
done
272+
273+
# Update release notes with auto-generated changelog
274+
echo "Updating release notes..."
275+
gh release edit "${{ github.event.inputs.release_tag }}" --generate-notes
276+
277+
else
278+
# Create new release with auto-generated notes and upload files
279+
echo "Creating new release with auto-generated notes..."
280+
cd upload-staging
281+
gh release create "${{ github.event.inputs.release_tag }}" \
282+
--title "Release ${{ github.event.inputs.release_tag }}" \
283+
--generate-notes \
284+
*.tar.gz
285+
fi
258286
259-
echo "Upload complete!"
287+
echo "Upload complete! Uploaded $FILE_COUNT prebuilds."
260288
261289
# Create a draft release for testing (when no release tag specified)
262290
- name: Create Draft Release with Prebuilds

0 commit comments

Comments
 (0)