Skip to content

Commit ea3ff57

Browse files
committed
[#176] GitHub Actions workflow for auto-merge 파일 세팅
1 parent edc64d1 commit ea3ff57

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Auto Merge on Tag Push
2+
3+
# 언제 이 자동화를 실행할지 정하는 부분 (트리거)
4+
on:
5+
push:
6+
tags:
7+
- 'v*' # 'v'로 시작하는 모든 태그 (예: v1.0.4, v1.1.0)
8+
- 'test/v*' # 'test/v'로 시작하는 모든 태그 (테스트용)
9+
10+
# 어떤 작업을 할지 정하는 부분
11+
jobs:
12+
auto-merge:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# 1. 코드를 내려받습니다.
16+
# 이때 2단계에서 등록한 PAT를 사용해야 브랜치 보호 규칙을 통과할 수 있습니다.
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GH_PAT }}
21+
fetch-depth: 0 # 모든 브랜치와 태그 히스토리를 가져옵니다.
22+
23+
# 2. Git 사용자 정보를 설정합니다. (커밋 메시지에 남을 이름)
24+
- name: Configure Git
25+
run: |
26+
git config user.name "GitHub Actions Bot"
27+
git config user.email "[email protected]"
28+
29+
# 3. 푸시된 태그를 main 브랜치에 병합하고 푸시합니다.
30+
- name: Merge tag into main
31+
run: |
32+
git checkout main
33+
git pull origin main
34+
# github.ref_name은 푸시된 태그의 이름(예: test/v1.0.4-alpha)을 의미합니다.
35+
git merge ${{ github.ref_name }} --no-ff -m "Merge tag ${{ github.ref_name }} into main"
36+
git push origin main
37+
38+
# 4. 방금 업데이트된 main 브랜치를 develop 브랜치에 병합하고 푸시합니다.
39+
- name: Merge main into develop
40+
run: |
41+
git checkout develop
42+
git pull origin develop
43+
git merge main --no-ff -m "Merge main into develop after release ${{ github.ref_name }}"
44+
git push origin develop

0 commit comments

Comments
 (0)