Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,49 @@ jobs:
- name: Install dependencies
run: bun install --frozen-lockfile

- name: Get version before release
id: version_before
run: echo "version=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_OUTPUT

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
HUSKY: 0
run: bun run semantic-release

- name: Get version after release
id: version_after
if: ${{ success() }}
run: echo "version=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_OUTPUT

- name: Get release notes
id: get_notes
if: ${{ success() && steps.version_after.outputs.version && steps.version_before.outputs.version != steps.version_after.outputs.version }}
run: |
NOTES=$(gh release view ${{ steps.version_after.outputs.version }} --json body -q .body | head -c 3900)
# Escape for JSON and handle multiline
NOTES=$(echo "$NOTES" | jq -Rs . | sed 's/^"//;s/"$//')
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Send Discord notification
if: ${{ success() && steps.version_after.outputs.version && steps.version_before.outputs.version != steps.version_after.outputs.version }}
continue-on-error: true
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
VERSION: ${{ steps.version_after.outputs.version }}
NOTES: ${{ steps.get_notes.outputs.notes }}
run: |
curl -X POST -H "Content-Type: application/json" \
-d @- "$DISCORD_WEBHOOK" <<EOF
{
"embeds": [{
"title": "New Release of Comp AI: ${VERSION}",
"description": "${NOTES}",
"color": 5814783
}]
}
EOF
10 changes: 0 additions & 10 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ module.exports = {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'semantic-release-discord-notifier',
{
embedJson: {
title: 'New Release of Comp AI: ${nextRelease.version}',
description: '${nextRelease.notes}',
color: 5814783,
},
},
],
'@semantic-release/changelog',
[
'@semantic-release/git',
Expand Down
Loading