Skip to content

Commit

Permalink
refactor(ci): Orient release notes on default Github release notes an…
Browse files Browse the repository at this point in the history
…d stop using a custom action to make releases (can't write the body)
  • Loading branch information
Mikey Stengel committed Oct 11, 2024
1 parent bb017bc commit 7a40b55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/editor-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '**' # Runs on all branches

jobs:
generate-changelog:
generate-editor-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -133,8 +133,10 @@ jobs:
if echo "$FILES" | jq -r '.[].filename' | grep -q "^packages/editor/"; then
PR_TITLE=$(echo "$PR_DATA" | jq -r '.title')
PR_URL=$(echo "$PR_DATA" | jq -r '.html_url')
PR_AUTHOR=$(echo "$PR_DATA" | jq -r '.user.login')
echo "PR #$pr touches editor package. Title: $PR_TITLE"
PR_TITLES="${PR_TITLES}- ${PR_TITLE}\n"
PR_TITLES="${PR_TITLES}- ${PR_TITLE}. Thank you @${PR_AUTHOR} in ${PR_URL}\n"
else
echo "PR #$pr does not touch editor package"
fi
Expand All @@ -157,6 +159,8 @@ jobs:
echo "## Changelog for version $CURRENT_VERSION" > packages/editor/CHANGELOG.md
echo "" >> packages/editor/CHANGELOG.md # Adds a newline after the heading
echo -e "$PR_TITLES" >> packages/editor/CHANGELOG.md
echo "" >> packages/editor/CHANGELOG.md # Adds a newline after the PR list
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/v$NPM_VERSION...v$CURRENT_VERSION" >> packages/editor/CHANGELOG.md
- name: Run Prettier on Changelog
if: env.version_changed == 'true' && env.no_editor_changes == 'false' && env.PR_TITLES != 'No relevant PRs found'
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/editor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ jobs:
- name: Create GitHub Release
if: steps.check_published.outputs.already_published == 'false'
uses: elgohr/Github-Release-Action@v5
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{ steps.get_version.outputs.version }}
title: 'Serlo Editor - v${{ steps.get_version.outputs.version }}'
body: |
## Serlo Editor Release Notes
${{ env.RELEASE_NOTES }}
run: |
curl -X POST \
-H "Authorization: token $GH_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{
"tag_name": "v${{ steps.get_version.outputs.version }}",
"name": "Serlo Editor - v${{ steps.get_version.outputs.version }}",
"body": ${{ toJson(env.RELEASE_NOTES) }}
}'

0 comments on commit 7a40b55

Please sign in to comment.