Skip to content

Commit f4416b0

Browse files
committed
feat: implement new Git Flow workflow strategy
- Add integrate-develop.yml for automatic PR creation from develop to staging - Add release-staging.yml for beta releases when changesets exist - Add update-version.yml for version updates in main branch - Add release-tag.yml for tag-based production releases - Move old workflows to legacy folder - Update RELEASE_STRATEGY.md and Korean version - Create comprehensive Git Flow documentation This new workflow implements: - Automated PR creation: develop → staging → main - Beta releases from staging with changesets - Version updates in main without npm publish - Tag-triggered production releases - Automatic branch synchronization
1 parent 25835c1 commit f4416b0

File tree

10 files changed

+1474
-205
lines changed

10 files changed

+1474
-205
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Integrate Develop to Staging
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
create-or-update-pr:
14+
name: Create or Update PR to Staging
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '22.10.0'
29+
30+
- name: Check for existing PR
31+
id: check-pr
32+
run: |
33+
EXISTING_PR=$(gh pr list --base staging --head develop --json number --jq '.[0].number' || echo "")
34+
35+
if [ -n "$EXISTING_PR" ]; then
36+
echo "pr_exists=true" >> $GITHUB_OUTPUT
37+
echo "pr_number=$EXISTING_PR" >> $GITHUB_OUTPUT
38+
echo "Found existing PR #$EXISTING_PR"
39+
else
40+
echo "pr_exists=false" >> $GITHUB_OUTPUT
41+
echo "No existing PR found"
42+
fi
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Get commit information
47+
id: commit-info
48+
run: |
49+
# Get the latest commits from develop that aren't in staging
50+
COMMITS=$(git log --pretty=format:"- %s (%h)" origin/staging..HEAD | head -20)
51+
COMMIT_COUNT=$(git rev-list --count origin/staging..HEAD)
52+
53+
# Escape for GitHub Actions output
54+
COMMITS="${COMMITS//'%'/'%25'}"
55+
COMMITS="${COMMITS//$'\n'/'%0A'}"
56+
COMMITS="${COMMITS//$'\r'/'%0D'}"
57+
58+
echo "commits<<EOF" >> $GITHUB_OUTPUT
59+
echo "$COMMITS" >> $GITHUB_OUTPUT
60+
echo "EOF" >> $GITHUB_OUTPUT
61+
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
62+
63+
# Get timestamp
64+
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
65+
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
66+
67+
- name: Create PR to staging
68+
if: steps.check-pr.outputs.pr_exists == 'false'
69+
run: |
70+
gh pr create \
71+
--base staging \
72+
--head develop \
73+
--title "🔄 Integrate develop → staging" \
74+
--body "## 🚀 Integration from develop to staging
75+
76+
### 📊 Summary
77+
- **Commits**: ${{ steps.commit-info.outputs.commit_count }} new commits
78+
- **Created**: ${{ steps.commit-info.outputs.timestamp }}
79+
- **Auto-generated**: This PR was automatically created by the integration workflow
80+
81+
### 📝 Recent Commits
82+
${{ steps.commit-info.outputs.commits }}
83+
84+
### 🔍 What happens next?
85+
1. Review the changes in this PR
86+
2. Run any necessary QA tests
87+
3. When approved and merged, the staging workflow will:
88+
- Check for changesets
89+
- If found, create beta releases
90+
- Automatically create a PR to main
91+
92+
### ⚡ Notes
93+
- This PR will be automatically updated with new commits to develop
94+
- Multiple features can accumulate in this single PR
95+
- Approval triggers the beta release process" \
96+
--label "integration" \
97+
--label "automated"
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
101+
- name: Update existing PR
102+
if: steps.check-pr.outputs.pr_exists == 'true'
103+
run: |
104+
# Update PR title with commit count
105+
gh pr edit ${{ steps.check-pr.outputs.pr_number }} \
106+
--title "🔄 Integrate develop → staging (${{ steps.commit-info.outputs.commit_count }} commits)"
107+
108+
# Get current PR body
109+
CURRENT_BODY=$(gh pr view ${{ steps.check-pr.outputs.pr_number }} --json body --jq '.body')
110+
111+
# Create updated section
112+
UPDATED_SECTION="### 🔄 Last Updated: ${{ steps.commit-info.outputs.timestamp }}
113+
**New commits**: ${{ steps.commit-info.outputs.commit_count }}
114+
115+
### 📝 Recent Commits
116+
${{ steps.commit-info.outputs.commits }}"
117+
118+
# Update or append the updated section
119+
if echo "$CURRENT_BODY" | grep -q "### 🔄 Last Updated:"; then
120+
# Replace existing update section
121+
NEW_BODY=$(echo "$CURRENT_BODY" | sed '/### 🔄 Last Updated:/,/### 📝 Recent Commits/d' | sed '/^$/d')
122+
NEW_BODY="$NEW_BODY
123+
124+
$UPDATED_SECTION"
125+
else
126+
# Append update section
127+
NEW_BODY="$CURRENT_BODY
128+
129+
---
130+
131+
$UPDATED_SECTION"
132+
fi
133+
134+
# Update PR body
135+
gh pr edit ${{ steps.check-pr.outputs.pr_number }} --body "$NEW_BODY"
136+
137+
# Add labels
138+
gh pr edit ${{ steps.check-pr.outputs.pr_number }} \
139+
--add-label "auto-updated" \
140+
--add-label "needs-review"
141+
142+
# Set as ready for review
143+
gh pr ready ${{ steps.check-pr.outputs.pr_number }} || true
144+
145+
echo "✅ Updated PR #${{ steps.check-pr.outputs.pr_number }} with ${{ steps.commit-info.outputs.commit_count }} new commits"
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.

0 commit comments

Comments
 (0)