Skip to content

Commit 1048e2d

Browse files
committed
ci: add workflow commit and contributor
1 parent 1512292 commit 1048e2d

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,47 @@ jobs:
2525
echo "version=$VERSION" >> $GITHUB_OUTPUT
2626
echo "Generated version: $VERSION"
2727
28+
- name: Generate changelog
29+
id: changelog
30+
run: |
31+
# Get the latest tag (if exists)
32+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
33+
34+
if [ -z "$LATEST_TAG" ]; then
35+
# No previous tag, get all commits
36+
COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges)
37+
CONTRIBUTORS=$(git log --pretty=format:"%an" --no-merges | sort -u)
38+
else
39+
# Get commits since last tag
40+
COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
41+
CONTRIBUTORS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%an" --no-merges | sort -u)
42+
fi
43+
44+
# Format contributors with @ prefix for GitHub mentions
45+
FORMATTED_CONTRIBUTORS=""
46+
while IFS= read -r author; do
47+
if [ ! -z "$author" ]; then
48+
FORMATTED_CONTRIBUTORS="${FORMATTED_CONTRIBUTORS}- ${author}\n"
49+
fi
50+
done <<< "$CONTRIBUTORS"
51+
52+
# Save commits to output (handle multiline)
53+
echo "commits<<EOF" >> $GITHUB_OUTPUT
54+
echo "$COMMITS" >> $GITHUB_OUTPUT
55+
echo "EOF" >> $GITHUB_OUTPUT
56+
57+
# Save contributors to output (handle multiline)
58+
echo "contributors<<EOF" >> $GITHUB_OUTPUT
59+
echo -e "$FORMATTED_CONTRIBUTORS" >> $GITHUB_OUTPUT
60+
echo "EOF" >> $GITHUB_OUTPUT
61+
62+
echo "Previous tag: ${LATEST_TAG:-none}"
63+
echo "Commits since last release:"
64+
echo "$COMMITS"
65+
echo ""
66+
echo "Contributors:"
67+
echo -e "$FORMATTED_CONTRIBUTORS"
68+
2869
- name: Set up Docker Buildx
2970
uses: docker/setup-buildx-action@v3
3071

@@ -72,9 +113,13 @@ jobs:
72113
tag_name: ${{ steps.version.outputs.version }}
73114
name: Release ${{ steps.version.outputs.version }}
74115
body: |
75-
## Changes
76-
- Built from commit: ${{ github.sha }}
77-
- Automatic release triggered by push to main
116+
## Commits
117+
${{ steps.changelog.outputs.commits }}
118+
119+
## Contributors
120+
Thanks to everyone who contributed to this release! :heart:
121+
122+
${{ steps.changelog.outputs.contributors }}
78123
79124
## Docker Images
80125
Docker images are available on Docker Hub with this version tag:

0 commit comments

Comments
 (0)