Skip to content

Commit 41ea96b

Browse files
author
Alexey Skobkin
committed
feat(ci) Generating changelogs for the release.
1 parent bad2e1b commit 41ea96b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,36 @@ jobs:
112112
echo "commit=$COMMIT" >> "$GITHUB_OUTPUT"
113113
echo "build_time=$BUILD_TIME" >> "$GITHUB_OUTPUT"
114114
115+
- name: Generate changelog
116+
id: changelog
117+
env:
118+
CURRENT_TAG: ${{ steps.vars.outputs.version }}
119+
run: |
120+
PREVIOUS_TAG="$(git tag --sort=-creatordate | grep -Fvx "$CURRENT_TAG" | head -n 1 || true)"
121+
if [ -n "$PREVIOUS_TAG" ]; then
122+
CHANGELOG="$(git log --no-merges --pretty=format:'- %s (%h)' "${PREVIOUS_TAG}..${CURRENT_TAG}")"
123+
if [ -z "$CHANGELOG" ]; then
124+
CHANGELOG="- No changes since ${PREVIOUS_TAG}."
125+
fi
126+
{
127+
echo "body<<'EOF'"
128+
echo "## Changes"
129+
echo ""
130+
printf '%s\n' "$CHANGELOG"
131+
echo ""
132+
echo "[Compare ${PREVIOUS_TAG}...${CURRENT_TAG}](https://github.com/${GITHUB_REPOSITORY}/compare/${PREVIOUS_TAG}...${CURRENT_TAG})"
133+
echo "EOF"
134+
} >> "$GITHUB_OUTPUT"
135+
else
136+
{
137+
echo "body<<'EOF'"
138+
echo "## Changes"
139+
echo ""
140+
echo "- Initial release."
141+
echo "EOF"
142+
} >> "$GITHUB_OUTPUT"
143+
fi
144+
115145
- name: Build release binary
116146
run: |
117147
mkdir -p dist
@@ -153,5 +183,6 @@ jobs:
153183
uses: softprops/action-gh-release@v2
154184
with:
155185
files: amdgputop-web_${{ steps.vars.outputs.version }}_linux_amd64.tar.gz
186+
body: ${{ steps.changelog.outputs.body }}
156187
env:
157188
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)