Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Write body of releases from our generated changelog #4186

Merged
merged 2 commits into from
Oct 14, 2024
Merged
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
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
20 changes: 13 additions & 7 deletions .github/workflows/editor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ 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 }}
RELEASE_VERSION: ${{ steps.get_version.outputs.version }}
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 @- << EOF
{
"tag_name": "v${RELEASE_VERSION}",
"name": "Serlo Editor - v${RELEASE_VERSION}",
"body": $(echo "$RELEASE_NOTES" | jq -Rs .)
}
EOF