mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 00:03:23 +00:00
feat: implement single squashed commit per release
🔄 **Ultra-Clean Git History:** Now creates one beautiful commit per release instead of multiple merge commits: **Before:** ``` abc123 Merge pull request #45 from version/minor def456 feat: add email scheduling ghi789 fix: validation bug jkl012 docs: update readme mno345 test: add unit tests ``` **After:** ``` abc123 ✨ Minor Release ## Changes ### 🚀 Features - Add email scheduling feature ### 🐛 Bug Fixes - Fix validation error handling ### 📚 Documentation - Update readme with new examples ``` **How it works:** 1. Analyzes commits since last release tag 2. Squashes all PR commits into single commit 3. Uses semantic emoji titles (🚀🔧🐛) 4. Includes AI-generated changelog with categorized changes 5. Adds version bump changes to same commit **Result:** Perfect git history with one meaningful commit per release! 🎉
This commit is contained in:
23
.github/workflows/version-and-publish.yml
vendored
23
.github/workflows/version-and-publish.yml
vendored
@@ -130,7 +130,7 @@ jobs:
|
|||||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Update merge commit with changelog
|
- name: Create single squashed commit with changelog
|
||||||
if: steps.version-type.outputs.type != 'none'
|
if: steps.version-type.outputs.type != 'none'
|
||||||
run: |
|
run: |
|
||||||
# Extract version type for commit title
|
# Extract version type for commit title
|
||||||
@@ -149,10 +149,21 @@ jobs:
|
|||||||
|
|
||||||
${{ steps.changelog.outputs.changelog }}"
|
${{ steps.changelog.outputs.changelog }}"
|
||||||
|
|
||||||
# Amend the merge commit with the clean message
|
# Get the previous commit (before the merge/PR commits)
|
||||||
git commit --amend -m "$NEW_MSG"
|
# This assumes we want to squash everything since the last release
|
||||||
|
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||||
|
if [ -n "$LAST_TAG" ]; then
|
||||||
|
BASE_COMMIT=$LAST_TAG
|
||||||
|
else
|
||||||
|
# If no tags, use the commit before this PR
|
||||||
|
BASE_COMMIT=$(git log --oneline --skip=10 -1 --format="%H" 2>/dev/null || git log --max-parents=0 --format="%H")
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Version bump
|
# Reset to the base and create a single squashed commit
|
||||||
|
git reset --soft $BASE_COMMIT
|
||||||
|
git commit -m "$NEW_MSG"
|
||||||
|
|
||||||
|
- name: Version bump and finalize commit
|
||||||
if: steps.version-type.outputs.type != 'none'
|
if: steps.version-type.outputs.type != 'none'
|
||||||
id: version-bump
|
id: version-bump
|
||||||
run: |
|
run: |
|
||||||
@@ -177,7 +188,7 @@ jobs:
|
|||||||
git add pnpm-lock.yaml
|
git add pnpm-lock.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Amend the merge commit to include version changes
|
# Amend the squashed commit to include version changes
|
||||||
git commit --amend --no-edit
|
git commit --amend --no-edit
|
||||||
|
|
||||||
# Create git tag
|
# Create git tag
|
||||||
@@ -185,7 +196,7 @@ jobs:
|
|||||||
|
|
||||||
${{ steps.changelog.outputs.changelog }}"
|
${{ steps.changelog.outputs.changelog }}"
|
||||||
|
|
||||||
echo "Version bumped from $CURRENT_VERSION to $NEW_VERSION"
|
echo "Created single squashed commit with version bump from $CURRENT_VERSION to $NEW_VERSION"
|
||||||
|
|
||||||
- name: Push version changes
|
- name: Push version changes
|
||||||
if: steps.version-type.outputs.type != 'none'
|
if: steps.version-type.outputs.type != 'none'
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ Make sure these secrets are configured in your GitHub repository:
|
|||||||
|
|
||||||
- ✅ Automatic version bumping based on branch
|
- ✅ Automatic version bumping based on branch
|
||||||
- ✅ AI-generated changelog using Claude Code CLI
|
- ✅ AI-generated changelog using Claude Code CLI
|
||||||
- ✅ Appends changelog to PR merge commit message
|
- ✅ Squashes all PR commits into single clean commit
|
||||||
- ✅ Runs tests before publishing
|
- ✅ Runs tests before publishing
|
||||||
- ✅ Builds the package before publishing
|
- ✅ Builds the package before publishing
|
||||||
- ✅ Creates git tags with changelog in tag message
|
- ✅ Creates git tags with changelog in tag message
|
||||||
@@ -103,10 +103,37 @@ The workflow automatically generates a standardized changelog for each release u
|
|||||||
- ⚡ **Performance** - Performance optimizations
|
- ⚡ **Performance** - Performance optimizations
|
||||||
|
|
||||||
The generated changelog is included in:
|
The generated changelog is included in:
|
||||||
- The PR merge commit message (automatically appended)
|
- The single squashed release commit message
|
||||||
- The git tag message
|
- The git tag message
|
||||||
- The GitHub release notes
|
- The GitHub release notes
|
||||||
|
|
||||||
|
## Git History Structure
|
||||||
|
|
||||||
|
The workflow creates an ultra-clean git history by squashing all commits from the PR into a single release commit:
|
||||||
|
|
||||||
|
**Before Squashing:**
|
||||||
|
```
|
||||||
|
abc123 feat: add email scheduling
|
||||||
|
def456 fix: validation bug
|
||||||
|
ghi789 docs: update readme
|
||||||
|
jkl012 test: add unit tests
|
||||||
|
```
|
||||||
|
|
||||||
|
**After Squashing:**
|
||||||
|
```
|
||||||
|
abc123 ✨ Minor Release
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
### 🚀 Features
|
||||||
|
- Add email scheduling feature
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
- Fix validation error handling
|
||||||
|
### 📚 Documentation
|
||||||
|
- Update readme with new examples
|
||||||
|
```
|
||||||
|
|
||||||
|
This results in one meaningful commit per release with all changes summarized in the AI-generated changelog.
|
||||||
|
|
||||||
## Version Branch Maintenance
|
## Version Branch Maintenance
|
||||||
|
|
||||||
Keep version branches up to date by periodically merging from main:
|
Keep version branches up to date by periodically merging from main:
|
||||||
|
|||||||
Reference in New Issue
Block a user