Skip to content

Commit 613bd95

Browse files
committed
ci: Output changelog to file and include changelog in release
1 parent d56e0e0 commit 613bd95

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/cd.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: Generate changelog
1313
runs-on: ubuntu-22.04
1414
outputs:
15-
release_body: ${{ steps.git-cliff.outputs.content }}
15+
changelog_body: ${{ steps.read_changelog.outputs.CHANGELOG_BODY }}
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
@@ -23,7 +23,7 @@ jobs:
2323
id: git-cliff
2424
with:
2525
config: cliff.toml
26-
args: -vv --latest --no-exec --github-repo ${{ github.repository }}
26+
args: -vv --latest --no-exec --github-repo ${{ github.repository }} -o CHANGELOG.md
2727
- name: Commit
2828
run: |
2929
git checkout ${{ github.ref_name }}
@@ -33,6 +33,15 @@ jobs:
3333
git add CHANGELOG.md
3434
git commit -m "Update changelog"
3535
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ${{ github.ref_name }}
36+
- name: Read CHANGELOG.md
37+
id: read_changelog
38+
shell: bash
39+
run: |
40+
r=$(cat CHANGELOG.md) # <--- Read release.md (Provide correct path as per your repo)
41+
r="${r//'%'/'%25'}" # Multiline escape sequences for %
42+
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
43+
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
44+
echo "CHANGELOG_BODY=$r" >> $GITHUB_OUTPUT # <--- Set environment variable
3645
3746
publish:
3847
name: Build and publish shadowJar
@@ -60,7 +69,7 @@ jobs:
6069
with:
6170
repo_token: ${{ secrets.GITHUB_TOKEN }}
6271
tag: ${{ github.ref }}
63-
body: ${{ needs.changelog.outputs.release_body }}
72+
body: ${{ needs.generate-changelog.outputs.changelog_body }}
6473
file: out/*
6574
file_glob: true
6675
overwrite: true

0 commit comments

Comments
 (0)