mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 00:03:23 +00:00
refactor: change to folder-based version branches
🗂️ **New Branch Structure:** Changed from version/ prefixes to folder-based branches: **Old Structure:** - version/major - version/minor - version/patch **New Structure:** - major/ (folder branch) - minor/ (folder branch) - patch/ (folder branch) **Usage Examples:** - major/breaking-api-changes - minor/new-email-features - patch/fix-validation-bug **Benefits:** ✅ More intuitive folder structure ✅ Better organization of related changes ✅ Clearer semantic meaning ✅ Multiple features can be worked on in parallel under same type **Updated Logic:** - Uses startsWith() instead of contains() for branch detection - Updated validation to check for folder branches - Enhanced error messages with examples
This commit is contained in:
27
.github/workflows/version-and-publish.yml
vendored
27
.github/workflows/version-and-publish.yml
vendored
@@ -11,7 +11,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
version-and-publish:
|
version-and-publish:
|
||||||
if: github.event_name == 'push' || (github.event.pull_request.merged == true && (contains(github.event.pull_request.head.ref, 'version/major') || contains(github.event.pull_request.head.ref, 'version/minor') || contains(github.event.pull_request.head.ref, 'version/patch')))
|
if: github.event_name == 'push' || (github.event.pull_request.merged == true && (startsWith(github.event.pull_request.head.ref, 'major/') || startsWith(github.event.pull_request.head.ref, 'minor/') || startsWith(github.event.pull_request.head.ref, 'patch/')))
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
new-version: ${{ steps.version-bump.outputs.new-version }}
|
new-version: ${{ steps.version-bump.outputs.new-version }}
|
||||||
@@ -62,26 +62,31 @@ jobs:
|
|||||||
echo "📦 Package: $PACKAGE_NAME"
|
echo "📦 Package: $PACKAGE_NAME"
|
||||||
echo "📌 Current Version: $CURRENT_VERSION"
|
echo "📌 Current Version: $CURRENT_VERSION"
|
||||||
|
|
||||||
# Validate version branches exist
|
# Validate version folder branches exist
|
||||||
echo "🔍 Validating version branches..."
|
echo "🔍 Validating version folder branches..."
|
||||||
MISSING_BRANCHES=""
|
MISSING_BRANCHES=""
|
||||||
|
|
||||||
for branch in "version/major" "version/minor" "version/patch"; do
|
for branch in "major" "minor" "patch"; do
|
||||||
if ! git ls-remote --heads origin "$branch" | grep -q "$branch"; then
|
if ! git ls-remote --heads origin "$branch" | grep -q "refs/heads/$branch$"; then
|
||||||
MISSING_BRANCHES="$MISSING_BRANCHES $branch"
|
MISSING_BRANCHES="$MISSING_BRANCHES $branch"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$MISSING_BRANCHES" ]; then
|
if [ -n "$MISSING_BRANCHES" ]; then
|
||||||
echo "❌ ERROR: Missing required version branches:$MISSING_BRANCHES"
|
echo "❌ ERROR: Missing required version folder branches:$MISSING_BRANCHES"
|
||||||
echo "Please create these branches first:"
|
echo "Please create these branches first:"
|
||||||
for branch in $MISSING_BRANCHES; do
|
for branch in $MISSING_BRANCHES; do
|
||||||
echo " git checkout -b $branch && git push origin $branch"
|
echo " git checkout -b $branch && git push origin $branch"
|
||||||
done
|
done
|
||||||
|
echo ""
|
||||||
|
echo "Then create feature branches under them like:"
|
||||||
|
echo " git checkout -b major/breaking-change"
|
||||||
|
echo " git checkout -b minor/new-feature"
|
||||||
|
echo " git checkout -b patch/bug-fix"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "✅ All version branches exist"
|
echo "✅ All version folder branches exist"
|
||||||
|
|
||||||
# Validate Node.js version matches package.json engines
|
# Validate Node.js version matches package.json engines
|
||||||
NODE_VERSION=$(node --version)
|
NODE_VERSION=$(node --version)
|
||||||
@@ -106,11 +111,11 @@ jobs:
|
|||||||
- name: Determine version bump type
|
- name: Determine version bump type
|
||||||
id: version-type
|
id: version-type
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.event.pull_request.head.ref }}" =~ version/major ]]; then
|
if [[ "${{ github.event.pull_request.head.ref }}" =~ ^major/ ]]; then
|
||||||
echo "type=major" >> $GITHUB_OUTPUT
|
echo "type=major" >> $GITHUB_OUTPUT
|
||||||
elif [[ "${{ github.event.pull_request.head.ref }}" =~ version/minor ]]; then
|
elif [[ "${{ github.event.pull_request.head.ref }}" =~ ^minor/ ]]; then
|
||||||
echo "type=minor" >> $GITHUB_OUTPUT
|
echo "type=minor" >> $GITHUB_OUTPUT
|
||||||
elif [[ "${{ github.event.pull_request.head.ref }}" =~ version/patch ]]; then
|
elif [[ "${{ github.event.pull_request.head.ref }}" =~ ^patch/ ]]; then
|
||||||
echo "type=patch" >> $GITHUB_OUTPUT
|
echo "type=patch" >> $GITHUB_OUTPUT
|
||||||
elif [[ "${{ github.event_name }}" == "push" ]]; then
|
elif [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
# Default to patch for direct pushes to main
|
# Default to patch for direct pushes to main
|
||||||
@@ -361,7 +366,7 @@ CLAUDE_EOF
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
notify-success:
|
notify-success:
|
||||||
if: github.event_name == 'push' || (github.event.pull_request.merged == true && (contains(github.event.pull_request.head.ref, 'version/major') || contains(github.event.pull_request.head.ref, 'version/minor') || contains(github.event.pull_request.head.ref, 'version/patch')))
|
if: github.event_name == 'push' || (github.event.pull_request.merged == true && (startsWith(github.event.pull_request.head.ref, 'major/') || startsWith(github.event.pull_request.head.ref, 'minor/') || startsWith(github.event.pull_request.head.ref, 'patch/')))
|
||||||
needs: version-and-publish
|
needs: version-and-publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user