refactor(ci): enhance hotfix workflow and rename workflow files
🔄 Hotfix Workflow Enhancements: - Accept tags from any environment (dev/stage/prod), not just production - Changed input parameter: 'production_tag' → 'tag' - Updated validation to show all available tags (not just prod) - Made terminology more generic throughout - Show 20 most recent tags instead of 10 for better visibility 📝 File Renames: - .github/workflows/mobile-hotfix.yml → hotfix-branch-creation.yml - .github/workflows/mobile-release.yml → product-release.yml Benefits: ✅ Hotfix workflow now works with dev/stage/prod tags ✅ More flexible for various hotfix scenarios ✅ Clearer, more descriptive workflow file names ✅ Consistent with product-agnostic terminology
This commit is contained in:
@@ -10,8 +10,8 @@ on:
|
|||||||
options:
|
options:
|
||||||
- worker
|
- worker
|
||||||
- client
|
- client
|
||||||
production_tag:
|
tag:
|
||||||
description: '🏷️ Current Production Tag (e.g., krow-withus-worker-mobile/prod-v0.1.0)'
|
description: '🏷️ Current Tag (e.g., krow-withus-worker-mobile/prod-v0.1.0 or dev/stage)'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
issue_description:
|
issue_description:
|
||||||
@@ -33,19 +33,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: 🔍 Validate production tag exists
|
- name: 🔍 Validate tag exists
|
||||||
id: validate_tag
|
id: validate_tag
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ github.event.inputs.production_tag }}"
|
TAG="${{ github.event.inputs.tag }}"
|
||||||
|
|
||||||
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||||
echo "❌ Error: Production tag '$TAG' does not exist"
|
echo "❌ Error: Tag '$TAG' does not exist"
|
||||||
echo "Available tags:"
|
echo "Available tags:"
|
||||||
git tag -l "krow-withus-*-mobile/prod-*" | tail -10
|
git tag -l "krow-withus-*-mobile/*" | tail -20
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "✅ Production tag exists: $TAG"
|
echo "✅ Tag exists: $TAG"
|
||||||
|
|
||||||
# Extract version from tag
|
# Extract version from tag
|
||||||
VERSION=$(echo "$TAG" | grep -oP 'v\K[0-9]+\.[0-9]+\.[0-9]+' || echo "")
|
VERSION=$(echo "$TAG" | grep -oP 'v\K[0-9]+\.[0-9]+\.[0-9]+' || echo "")
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "current_version=${VERSION}" >> $GITHUB_OUTPUT
|
echo "current_version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "📌 Current production version: $VERSION"
|
echo "📌 Current version: $VERSION"
|
||||||
|
|
||||||
- name: 🔢 Calculate hotfix version
|
- name: 🔢 Calculate hotfix version
|
||||||
id: hotfix_version
|
id: hotfix_version
|
||||||
@@ -93,15 +93,15 @@ jobs:
|
|||||||
|
|
||||||
echo "✅ Branch does not exist, proceeding..."
|
echo "✅ Branch does not exist, proceeding..."
|
||||||
|
|
||||||
- name: 🌿 Create hotfix branch from production tag
|
- name: 🌿 Create hotfix branch from tag
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ github.event.inputs.production_tag }}"
|
TAG="${{ github.event.inputs.tag }}"
|
||||||
BRANCH="${{ steps.branch.outputs.branch_name }}"
|
BRANCH="${{ steps.branch.outputs.branch_name }}"
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
# Checkout the production tag
|
# Checkout the tag
|
||||||
git checkout "$TAG"
|
git checkout "$TAG"
|
||||||
|
|
||||||
# Create new branch
|
# Create new branch
|
||||||
@@ -193,7 +193,7 @@ HOTFIX: ${ISSUE}
|
|||||||
- Add CHANGELOG entry
|
- Add CHANGELOG entry
|
||||||
- Ready for bug fix commits
|
- Ready for bug fix commits
|
||||||
|
|
||||||
From production tag: ${{ github.event.inputs.production_tag }}"
|
From tag: ${{ github.event.inputs.tag }}"
|
||||||
|
|
||||||
echo "✅ Committed version changes"
|
echo "✅ Committed version changes"
|
||||||
|
|
||||||
@@ -223,11 +223,11 @@ From production tag: ${{ github.event.inputs.production_tag }}"
|
|||||||
|
|
||||||
PR_TITLE="🚨 HOTFIX: ${APP_DISPLAY} v${HOTFIX_VERSION} - ${ISSUE}"
|
PR_TITLE="🚨 HOTFIX: ${APP_DISPLAY} v${HOTFIX_VERSION} - ${ISSUE}"
|
||||||
|
|
||||||
PR_BODY="## 🚨 HOTFIX - URGENT PRODUCTION FIX
|
PR_BODY="## 🚨 HOTFIX - URGENT FIX
|
||||||
|
|
||||||
**App:** ${APP_DISPLAY}
|
**App:** ${APP_DISPLAY}
|
||||||
**Version:** ${HOTFIX_VERSION}
|
**Version:** ${HOTFIX_VERSION}
|
||||||
**From:** \`${{ github.event.inputs.production_tag }}\`
|
**From:** \`${{ github.event.inputs.tag }}\`
|
||||||
|
|
||||||
### Issue
|
### Issue
|
||||||
${ISSUE}
|
${ISSUE}
|
||||||
@@ -289,7 +289,7 @@ git push origin krow-withus-${APP}-mobile/prod-v${HOTFIX_VERSION}
|
|||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**App:** ${{ github.event.inputs.app }}" >> $GITHUB_STEP_SUMMARY
|
echo "**App:** ${{ github.event.inputs.app }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Issue:** ${{ github.event.inputs.issue_description }}" >> $GITHUB_STEP_SUMMARY
|
echo "**Issue:** ${{ github.event.inputs.issue_description }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**From Tag:** \`${{ github.event.inputs.production_tag }}\`" >> $GITHUB_STEP_SUMMARY
|
echo "**From Tag:** \`${{ github.event.inputs.tag }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Current Version:** ${{ steps.validate_tag.outputs.current_version }}" >> $GITHUB_STEP_SUMMARY
|
echo "**Current Version:** ${{ steps.validate_tag.outputs.current_version }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Hotfix Version:** ${{ steps.hotfix_version.outputs.hotfix_version }}" >> $GITHUB_STEP_SUMMARY
|
echo "**Hotfix Version:** ${{ steps.hotfix_version.outputs.hotfix_version }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Branch:** \`${{ steps.branch.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY
|
echo "**Branch:** \`${{ steps.branch.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
@@ -112,9 +112,9 @@ jobs:
|
|||||||
|
|
||||||
# Generate release title
|
# Generate release title
|
||||||
if [ "$APP" = "worker" ]; then
|
if [ "$APP" = "worker" ]; then
|
||||||
APP_DISPLAY="Worker Product"
|
APP_DISPLAY="Worker Mobile Application"
|
||||||
else
|
else
|
||||||
APP_DISPLAY="Client Product"
|
APP_DISPLAY="Client Mobile Application"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ENV_UPPER=$(echo "$ENV" | tr '[:lower:]' '[:upper:]')
|
ENV_UPPER=$(echo "$ENV" | tr '[:lower:]' '[:upper:]')
|
||||||
Reference in New Issue
Block a user