mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 00:03:23 +00:00
feat: integrate changelog directly into PR merge commit
🔧 **Improved Changelog Integration:** - Changelog is now appended to the PR merge commit message instead of creating a separate commit - Version bump changes are included in the same amended merge commit - Uses git commit --amend to modify the merge commit with both changelog and version changes - Updated force push with --force-with-lease for safer history rewriting - Cleaner git history with single commit containing all release information **Benefits:** - ✅ Single commit per release (cleaner history) - ✅ Changelog directly visible in merge commit - ✅ No additional 'chore: bump version' commits - ✅ All release info consolidated in one place - ✅ Safer force push with --force-with-lease
This commit is contained in:
25
.github/workflows/version-and-publish.yml
vendored
25
.github/workflows/version-and-publish.yml
vendored
@@ -130,6 +130,23 @@ jobs:
|
|||||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Update merge commit with changelog
|
||||||
|
if: steps.version-type.outputs.type != 'none'
|
||||||
|
run: |
|
||||||
|
# Get the merge commit (HEAD)
|
||||||
|
MERGE_COMMIT=$(git rev-parse HEAD)
|
||||||
|
|
||||||
|
# Get original commit message
|
||||||
|
ORIGINAL_MSG=$(git log -1 --format=%B)
|
||||||
|
|
||||||
|
# Create new commit message with changelog
|
||||||
|
NEW_MSG="$ORIGINAL_MSG
|
||||||
|
|
||||||
|
${{ steps.changelog.outputs.changelog }}"
|
||||||
|
|
||||||
|
# Amend the merge commit with the new message
|
||||||
|
git commit --amend -m "$NEW_MSG"
|
||||||
|
|
||||||
- name: Version bump
|
- name: Version bump
|
||||||
if: steps.version-type.outputs.type != 'none'
|
if: steps.version-type.outputs.type != 'none'
|
||||||
id: version-bump
|
id: version-bump
|
||||||
@@ -145,7 +162,7 @@ jobs:
|
|||||||
NEW_VERSION=$(node -p "require('./package.json').version")
|
NEW_VERSION=$(node -p "require('./package.json').version")
|
||||||
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Create commit with changelog
|
# Stage version changes
|
||||||
git add package.json
|
git add package.json
|
||||||
# Add lockfile if it exists (npm version might create package-lock.json)
|
# Add lockfile if it exists (npm version might create package-lock.json)
|
||||||
if [ -f package-lock.json ]; then
|
if [ -f package-lock.json ]; then
|
||||||
@@ -154,9 +171,9 @@ jobs:
|
|||||||
if [ -f pnpm-lock.yaml ]; then
|
if [ -f pnpm-lock.yaml ]; then
|
||||||
git add pnpm-lock.yaml
|
git add pnpm-lock.yaml
|
||||||
fi
|
fi
|
||||||
git commit -m "chore: bump version to v$NEW_VERSION
|
|
||||||
|
|
||||||
${{ steps.changelog.outputs.changelog }}"
|
# Amend the merge commit to include version changes
|
||||||
|
git commit --amend --no-edit
|
||||||
|
|
||||||
# Create git tag
|
# Create git tag
|
||||||
git tag -a "v$NEW_VERSION" -m "Version $NEW_VERSION
|
git tag -a "v$NEW_VERSION" -m "Version $NEW_VERSION
|
||||||
@@ -168,7 +185,7 @@ jobs:
|
|||||||
- name: Push version changes
|
- name: Push version changes
|
||||||
if: steps.version-type.outputs.type != 'none'
|
if: steps.version-type.outputs.type != 'none'
|
||||||
run: |
|
run: |
|
||||||
git push origin main
|
git push --force-with-lease origin main
|
||||||
git push origin --tags
|
git push origin --tags
|
||||||
|
|
||||||
- name: Publish to NPM
|
- name: Publish to NPM
|
||||||
|
|||||||
@@ -84,6 +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
|
||||||
- ✅ 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
|
||||||
@@ -102,7 +103,7 @@ 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 version bump commit message
|
- The PR merge commit message (automatically appended)
|
||||||
- The git tag message
|
- The git tag message
|
||||||
- The GitHub release notes
|
- The GitHub release notes
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user