-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (49 loc) · 2.17 KB
/
create-release-branch.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: "[CD] Create Release Branch and Update App Version"
on:
schedule:
- cron: '0 8 * * 5' # 한국 기준으로 매주 금요일 오후 5시에 실행해요
workflow_dispatch:
env:
BRANCH_PREFIX: release
permissions:
contents: write
pull-requests: write
jobs:
create-release-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Git User Info
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Calculate Release Version
id: calculate-distribution-version
uses: ./.github/actions/calculate-distribution-version
- name: Check Release Branch
run: |
echo "원격 브랜치 중 '${{ env.BRANCH_PREFIX }}/*' 형태가 존재하는지 확인해요"
existing_branches=$(git ls-remote --heads origin | grep "refs/heads/${{ env.BRANCH_PREFIX }}/" || true)
if [ -n "$existing_branches" ]; then
formatted_branches=$(echo "$existing_branches" | sed 's/.*refs\/heads\///')
echo "$formatted_branches 브랜치들이 이미 존재해서 작업을 종료해요"
fi
- name: Create Release Branch
run: |
branch_name="${{ env.BRANCH_PREFIX }}/${{ steps.calculate-distribution-version.outputs.version_code }}"
echo "릴리즈 브랜치 생성"
git switch -c $branch_name
git push origin $branch_name
echo "브랜치 $branch_name 생성했어요"
- name: Update App Version
uses: ./.github/actions/update-app-version
with:
year: ${{ steps.calculate-distribution-version.outputs.year }}
week_no: ${{ steps.calculate-distribution-version.outputs.week }}
hotfix: ${{ steps.calculate-distribution-version.outputs.hotfix }}
file: ./app-version.json
- name: Create Pull Request to Release
uses: ./.github/actions/create-pull-request-to-release
with:
branch: "${{ env.BRANCH_PREFIX }}/${{ steps.calculate-distribution-version.outputs.version_code }}"