ci: add changelog as job output

This commit is contained in:
Loric ANDRE 2026-07-16 12:06:48 +02:00
parent 09479547eb
commit 95c360996a
2 changed files with 21 additions and 4 deletions

View file

@ -20,6 +20,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
version: ${{ steps.version.outputs.version }} version: ${{ steps.version.outputs.version }}
changelog: ${{ steps.changelog.outputs.content }}
steps: steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with: with:
@ -56,6 +57,18 @@ jobs:
echo "$VERSION" > shell/version.txt echo "$VERSION" > shell/version.txt
git diff --binary -- CHANGELOG.md Cargo.lock Cargo.toml man shell > "$RUNNER_TEMP/release.patch" git diff --binary -- CHANGELOG.md Cargo.lock Cargo.toml man shell > "$RUNNER_TEMP/release.patch"
test -s "$RUNNER_TEMP/release.patch" test -s "$RUNNER_TEMP/release.patch"
- id: changelog
name: Render release changelog
if: steps.version.outputs.version != ''
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
delimiter="changelog-$(cat /proc/sys/kernel/random/uuid)"
{
echo "content<<$delimiter"
git cliff -u -t "v$VERSION" --strip all
echo "$delimiter"
} >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: steps.version.outputs.version != '' if: steps.version.outputs.version != ''
with: with:
@ -103,6 +116,7 @@ jobs:
env: env:
GH_TOKEN: ${{ steps.app-token.outputs.token }} GH_TOKEN: ${{ steps.app-token.outputs.token }}
VERSION: ${{ needs.prepare.outputs.version }} VERSION: ${{ needs.prepare.outputs.version }}
CHANGELOG: ${{ needs.prepare.outputs.changelog }}
shell: bash shell: bash
run: | run: |
auth="$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)" auth="$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)"
@ -112,7 +126,9 @@ jobs:
Automated release preparation for v$VERSION. Automated release preparation for v$VERSION.
This branch is rebuilt from master as one commit on every push. Merge it with the repository's required squash merge; the resulting commit will be tagged v$VERSION and picked up by the release workflow. This branch is rebuilt from master as one commit on every push. Merge it with the repository's required squash merge; the resulting commit will be tagged v$VERSION and picked up by the release workflow.
EOF EOF
printf '%s\n' "$CHANGELOG" >> "$RUNNER_TEMP/pr-body.md"
pr="$(gh pr list --base master --head release-pr --state open --json number --jq '.[0].number')" pr="$(gh pr list --base master --head release-pr --state open --json number --jq '.[0].number')"
if [[ -n "$pr" ]]; then if [[ -n "$pr" ]]; then

View file

@ -91,15 +91,16 @@ commit_parsers = [
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" }, { message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" }, { message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" }, { message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^ci", group = "<!-- 7 -->🤖 CI" },
{ message = "^chore\\(release\\): prepare for", skip = true }, { message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true }, { message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true }, { message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true }, { message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" }, { message = "^chore", group = "<!-- 8 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" }, { body = ".*security", group = "<!-- 9 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" }, { message = "^revert", group = "<!-- 10 -->◀️ Revert" },
{ message = "^release", skip = true }, { message = "^release", skip = true },
{ message = ".*", group = "<!-- 10 -->💼 Other" }, { message = ".*", group = "<!-- 11 -->💼 Other" },
] ]
# Exclude commits that are not matched by any commit parser. # Exclude commits that are not matched by any commit parser.
filter_commits = false filter_commits = false