Skip to content

Commit 78e3012

Browse files
committed
update(workflows): Discord Notification
1 parent 499f391 commit 78e3012

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/build.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,102 @@ jobs:
334334
tag_name: ${{ env.TAG_NAME }}
335335
name: Release v${{ needs.versioning.outputs.semVer }}
336336
body: ${{ needs.versioning.outputs.semVer }}
337+
338+
- name: Get commit summary for beta
339+
if: github.ref == 'refs/heads/beta'
340+
id: beta_commits
341+
run: |
342+
COMMITS=$(git log -5 --pretty=format:"• %s (%h)" | head -c 1000)
343+
echo "summary<<EOF" >> $GITHUB_OUTPUT
344+
echo "$COMMITS" >> $GITHUB_OUTPUT
345+
echo "EOF" >> $GITHUB_OUTPUT
346+
347+
- name: Send Discord notification (Beta)
348+
if: github.ref == 'refs/heads/beta'
349+
run: |
350+
curl -H "Content-Type: application/json" \
351+
-d '{
352+
"embeds": [{
353+
"title": "🚀 New Beta Release",
354+
"description": "**SwiftlyS2** v${{ needs.versioning.outputs.semVer }} has been released!",
355+
"color": 65261,
356+
"fields": [
357+
{
358+
"name": "📦 Version",
359+
"value": "`${{ needs.versioning.outputs.semVer }}`",
360+
"inline": true
361+
},
362+
{
363+
"name": "🔖 Tag",
364+
"value": "`${{ env.TAG_NAME }}`",
365+
"inline": true
366+
},
367+
{
368+
"name": "📝 Recent Commits",
369+
"value": "${{ steps.beta_commits.outputs.summary }}",
370+
"inline": false
371+
},
372+
{
373+
"name": "📥 Download",
374+
"value": "[View Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.TAG_NAME }})",
375+
"inline": false
376+
}
377+
],
378+
"timestamp": "${{ github.event.head_commit.timestamp }}",
379+
"footer": {
380+
"text": "Beta Release • SwiftlyS2"
381+
}
382+
}]
383+
}' \
384+
${{ secrets.DISCORD_WEBHOOK_BETA }}
385+
386+
- name: Get commit summary for master
387+
if: github.ref == 'refs/heads/master'
388+
id: master_commits
389+
run: |
390+
COMMITS=$(git log -10 --pretty=format:"• %s (%h)" | head -c 1000)
391+
echo "summary<<EOF" >> $GITHUB_OUTPUT
392+
echo "$COMMITS" >> $GITHUB_OUTPUT
393+
echo "EOF" >> $GITHUB_OUTPUT
394+
395+
- name: Send Discord notification (Master)
396+
if: github.ref == 'refs/heads/master'
397+
run: |
398+
curl -H "Content-Type: application/json" \
399+
-d '{
400+
"embeds": [{
401+
"title": "✨ New Stable Release",
402+
"description": "**SwiftlyS2** v${{ needs.versioning.outputs.semVer }} is now available!",
403+
"color": 65261,
404+
"fields": [
405+
{
406+
"name": "📦 Version",
407+
"value": "`${{ needs.versioning.outputs.semVer }}`",
408+
"inline": true
409+
},
410+
{
411+
"name": "🔖 Tag",
412+
"value": "`${{ env.TAG_NAME }}`",
413+
"inline": true
414+
},
415+
{
416+
"name": "📝 Changelog Summary",
417+
"value": "${{ steps.master_commits.outputs.summary }}",
418+
"inline": false
419+
},
420+
{
421+
"name": "📥 Download",
422+
"value": "[View Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.TAG_NAME }})",
423+
"inline": false
424+
}
425+
],
426+
"timestamp": "${{ github.event.head_commit.timestamp }}",
427+
"footer": {
428+
"text": "Stable Release • SwiftlyS2"
429+
}
430+
}]
431+
}' \
432+
${{ secrets.DISCORD_WEBHOOK_MASTER }}
337433
nuget:
338434
if: ${{ github.event_name == 'push' && github.repository_owner == 'swiftly-solution' }}
339435
needs: [versioning, releasing]

0 commit comments

Comments
 (0)