Skip to content

Commit 94b7a91

Browse files
committed
Extract release-description to a step
1 parent 7ead769 commit 94b7a91

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/ci-cd.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,35 @@ jobs:
128128

129129
release:
130130
needs: [ version, push ]
131-
if: needs.version.outputs.releasable == 'true'
132131
runs-on: ubuntu-latest
133132
permissions:
134133
contents: write
135134
steps:
136135
- uses: actions/checkout@v3
136+
- name: Generate release description
137+
run: |
138+
log_content() {
139+
local content="$1"
140+
local label="${2:-}"
141+
142+
if [[ -n "$label" ]]; then
143+
# Replace the beginning of each line with two spaces
144+
local indented_content="${content//$'\n'/$'\n' }"
145+
printf "%s:\n %s\n" "$label" "$indented_content"
146+
else
147+
echo "$content"
148+
fi
149+
}
150+
CHANGELOG_URL="https://github.com/${{ github.event.repository.full_name }}/compare/${{ needs.version.outputs.previous-release-tag }}...v${{ needs.version.outputs.semver }}"
151+
echo "BODY=**Full Changelog**: $CHANGELOG_URL" >> $GITHUB_ENV
152+
echo ::group::Set outputs
153+
log_content "$(cat "$GITHUB_ENV")" "GITHUB_ENV"
154+
echo ::endgroup::
155+
137156
- uses: softprops/action-gh-release@v1
157+
if: needs.version.outputs.releasable == 'true'
138158
with:
139-
body: "**Full Changelog**: https://github.com/${{ github.event.repository.full_name }}/compare/${{ needs.version.outputs.previous-release-tag }}...v${{ needs.version.outputs.semver }}"
159+
body: ${{ env.BODY }}
140160
generate_release_notes: true
141161
tag_name: v${{ needs.version.outputs.semver }}
142162
token: ${{ secrets.PAT }} # using our own PAT so other workflows run

0 commit comments

Comments
 (0)