@@ -37,39 +37,37 @@ jobs:
3737 HUSKY : 0
3838 run : bun run semantic-release
3939
40- - name : Get version after release
41- id : version_after
42- if : ${{ success() }}
43- run : echo "version=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_OUTPUT
44-
45- - name : Get release notes
46- id : get_notes
47- if : ${{ success() && steps.version_after.outputs.version && steps.version_before.outputs.version != steps.version_after.outputs.version }}
40+ - name : Check if release was created
41+ id : check_release
4842 run : |
49- NOTES=$(gh release view ${{ steps.version_after.outputs.version }} --json body -q .body | head -c 3900)
50- # Escape for JSON and handle multiline
51- NOTES=$(echo "$NOTES" | jq -Rs . | sed 's/^"//;s/"$//')
52- echo "notes<<EOF" >> $GITHUB_OUTPUT
53- echo "$NOTES" >> $GITHUB_OUTPUT
54- echo "EOF" >> $GITHUB_OUTPUT
55- env :
56- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+ # Get the latest version after semantic-release
44+ VERSION_AFTER=$(git describe --tags --abbrev=0 2>/dev/null || echo '')
45+ echo "version_after=$VERSION_AFTER" >> $GITHUB_OUTPUT
5746
58- - name : Send Discord notification
59- if : ${{ success() && steps.version_after.outputs.version && steps.version_before.outputs.version != steps.version_after.outputs.version }}
60- continue-on-error : true
47+ # Check if version changed
48+ if [ "${{ steps.version_before.outputs.version }}" != "$VERSION_AFTER" ] && [ ! -z "$VERSION_AFTER" ]; then
49+ echo "release_created=true" >> $GITHUB_OUTPUT
50+ else
51+ echo "release_created=false" >> $GITHUB_OUTPUT
52+ fi
53+
54+ - name : Merge release back to main
55+ if : ${{ steps.check_release.outputs.release_created == 'true' }}
6156 env :
62- DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
63- VERSION : ${{ steps.version_after.outputs.version }}
64- NOTES : ${{ steps.get_notes.outputs.notes }}
57+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
6558 run : |
66- curl -X POST -H "Content-Type: application/json" \
67- -d @- "$DISCORD_WEBHOOK" <<EOF
68- {
69- "embeds": [{
70- "title": "New Release of Comp AI: ${VERSION}",
71- "description": "${NOTES}",
72- "color": 5814783
73- }]
74- }
75- EOF
59+ # Configure git
60+ git config user.name "github-actions[bot]"
61+ git config user.email "github-actions[bot]@users.noreply.github.com"
62+
63+ # Fetch all branches to ensure we have latest
64+ git fetch origin
65+
66+ # Checkout main
67+ git checkout -B main origin/main
68+
69+ # Merge release branch (which now has the new release commits)
70+ git merge --no-ff origin/release -m "chore: merge release ${{ steps.check_release.outputs.version_after }} back to main [skip ci]"
71+
72+ # Push to main
73+ git push origin main
0 commit comments