[CD] Create Release Branch and Update App Version #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
with: | |
file: ./app-version.json | |
- 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 }}" | |
version_name: "${{ steps.calculate-distribution-version.outputs.version_name }}" | |
github_token: "${{ secrets.GITHUB_TOKEN }}" |