Skip to content

Commit

Permalink
Update: Updated Changelogs
Browse files Browse the repository at this point in the history
  • Loading branch information
louanfontenele committed Dec 29, 2024
1 parent ff0045f commit 764e7c1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
16 changes: 6 additions & 10 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ categories:
- title: "🐛 Fixes"
labels:
- "fix"
- title: "📄 Documentation"
- title: "🔄 Updates"
labels:
- "docs"
- title: "🧰 Maintenance"
- "update"
- title: "🗑️ Removes"
labels:
- "chore"
- "refactor"
- "remove"

change-template: "- $TITLE by @$AUTHOR in #$NUMBER"
change-template: "- $TITLE by @$AUTHOR"
no-labels-template: "- $TITLE (commit: [`$SHORT_SHA`](https://github.com/${{ github.repository }}/commit/$FULL_SHA))"

template: |
🚀 **Release ${{ nextReleaseVersion }}**
### What's Changed
## 🚀 Release ${{ nextReleaseVersion }}
$CHANGES
---
**Full commit history:** [Compare Changes](https://github.com/${{ github.repository }}/compare/${{ previousTag }}...${{ currentTag }})
54 changes: 28 additions & 26 deletions .github/scripts/generate-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,64 @@ CHANGELOG_FILE="CHANGELOG.md"
LATEST_TAG=${previous_tag:-"N/A"}
NEW_TAG=${current_tag:-"N/A"}

# Initialize changelog sections
FEATURES=""
FIXES=""
UPDATES=""
REMOVES=""

# Initialize changelog
if [ "$LATEST_TAG" == "N/A" ]; then
echo "No previous tag found. Initial release."
LATEST_TAG=""
fi

# Create or update the changelog
echo "## 🚀 Release $NEW_TAG" > $CHANGELOG_FILE
echo "### What's Changed" >> $CHANGELOG_FILE
echo "## 🚀 Release $NEW_TAG 🎉" > $CHANGELOG_FILE
echo "" >> $CHANGELOG_FILE
echo "What's Changed" >> $CHANGELOG_FILE
echo "" >> $CHANGELOG_FILE

# Categories initialization
FEATURES=""
FIXES=""
DOCS=""
MAINTENANCE=""

# Append commit history to the correct categories
# Categorize commit messages
while IFS= read -r line; do
case "$line" in
"Feature:"*) FEATURES+="- ${line}\n" ;;
"Fix:"*) FIXES+="- ${line}\n" ;;
"Docs:"*) DOCS+="- ${line}\n" ;;
"Chore:"*) MAINTENANCE+="- ${line}\n" ;;
case $line in
"Feature:"*) FEATURES+="- ${line#*:}\n" ;;
"Fix:"*) FIXES+="- ${line#*:}\n" ;;
"Update:"*) UPDATES+="- ${line#*:}\n" ;;
"Remove:"*) REMOVES+="- ${line#*:}\n" ;;
esac
done < <(git log --pretty=format:"%s" $LATEST_TAG..HEAD)

# Add categories to changelog
# Populate changelog
echo "**🌟 Features**" >> $CHANGELOG_FILE
if [ -n "$FEATURES" ]; then
echo -e "$FEATURES" >> $CHANGELOG_FILE
else
echo "_- No new features_" >> $CHANGELOG_FILE
echo "- _*No new features*_ " >> $CHANGELOG_FILE
fi

echo "**🐛 Fixes**" >> $CHANGELOG_FILE
if [ -n "$FIXES" ]; then
echo -e "$FIXES" >> $CHANGELOG_FILE
else
echo "_- No bugs fixed_" >> $CHANGELOG_FILE
echo "- _*No bug fixes*_ " >> $CHANGELOG_FILE
fi

echo "**📄 Documentation**" >> $CHANGELOG_FILE
if [ -n "$DOCS" ]; then
echo -e "$DOCS" >> $CHANGELOG_FILE
echo "**🔄 Updates**" >> $CHANGELOG_FILE
if [ -n "$UPDATES" ]; then
echo -e "$UPDATES" >> $CHANGELOG_FILE
else
echo "_- No documentation updates_" >> $CHANGELOG_FILE
echo "- _*No updates*_ " >> $CHANGELOG_FILE
fi

echo "**🧰 Maintenance**" >> $CHANGELOG_FILE
if [ -n "$MAINTENANCE" ]; then
echo -e "$MAINTENANCE" >> $CHANGELOG_FILE
echo "**🗑️ Removes**" >> $CHANGELOG_FILE
if [ -n "$REMOVES" ]; then
echo -e "$REMOVES" >> $CHANGELOG_FILE
else
echo "_- No maintenance updates_" >> $CHANGELOG_FILE
echo "- _*Nothing removed*_ " >> $CHANGELOG_FILE
fi

echo "" >> $CHANGELOG_FILE
# Add full commit history link
REPO_URL="https://github.com/${GITHUB_REPOSITORY}/compare/"
echo "" >> $CHANGELOG_FILE
echo "**Full commit history:** [Compare Changes](${REPO_URL}${LATEST_TAG}...${NEW_TAG})" >> $CHANGELOG_FILE
6 changes: 3 additions & 3 deletions .github/workflows/release-windows-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
if [ -z "$LATEST_TAG" ]; then
NEW_TAG="${GAME_VERSION}-1.0"
echo "Creating initial tag: $NEW_TAG"
git tag -a $NEW_TAG -m "Initial Release $NEW_TAG"
git push origin $NEW_TAG
else
Expand All @@ -75,7 +76,6 @@ jobs:
run: ./.github/scripts/generate-changelog.sh
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}

# Read Changelog Content into Environment Variable
- name: Read Changelog
Expand All @@ -88,14 +88,14 @@ jobs:
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Publish the Release
- name: Publish Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.current_tag }}
name: "🚀 Release ${{ env.current_tag }}"
name: "Release ${{ env.current_tag }}"
body: ${{ env.CHANGELOG }}
artifacts: "release.zip"
draft: false
Expand Down

0 comments on commit 764e7c1

Please sign in to comment.