From f5d033f201fd68f1216a3cd9ee01a53650e93f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EB=AF=B8?= Date: Tue, 11 Aug 2026 17:09:38 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20=EC=83=81=EC=9A=A9=20=EB=B0=B0=ED=8F=AC?= =?UTF-8?q?=EC=9A=A9=20=ED=83=9C=EA=B7=B8=20=EC=9E=90=EB=8F=99=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(Promote=20to=20Production)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git tag를 로컬에서 직접 만들고 push하는 게 번거롭다는 피드백에 따라, GitHub Actions workflow_dispatch로 버튼 한 번(또는 gh workflow run)에 다음 semver 태그를 계산해 생성/push하는 워크플로를 추가했다. 이 태그 push가 prod-cd.yml의 트리거(on.push.tags)를 실행시켜 상용 배포로 이어진다. --- .github/workflows/promote-to-prod.yml | 69 +++++++++++++++++++++++++++ README.md | 9 +++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/promote-to-prod.yml diff --git a/.github/workflows/promote-to-prod.yml b/.github/workflows/promote-to-prod.yml new file mode 100644 index 0000000..1f6e0c3 --- /dev/null +++ b/.github/workflows/promote-to-prod.yml @@ -0,0 +1,69 @@ +# GitHub Actions 탭에서 버튼 한 번으로 상용 배포를 트리거하기 위한 워크플로. +# main의 다음 semver 태그(v1.2.3 형태)를 자동으로 계산해 push하고, +# 그 태그 push가 prod-cd.yml의 트리거(on.push.tags)를 실행시켜 상용 배포로 이어진다. +name: Promote to Production + +on: + workflow_dispatch: + inputs: + bump: + description: "버전 증가 단위" + required: true + default: "patch" + type: choice + options: + - patch + - minor + - major + +permissions: + contents: write + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: 다음 버전 태그 계산 + id: version + run: | + git fetch --tags + LATEST=$(git tag --list 'v*' --sort=-v:refname | head -n1) + if [ -z "$LATEST" ]; then + LATEST="v0.0.0" + fi + echo "현재 최신 태그: $LATEST" + + VERSION=${LATEST#v} + MAJOR=$(echo "$VERSION" | cut -d. -f1) + MINOR=$(echo "$VERSION" | cut -d. -f2) + PATCH=$(echo "$VERSION" | cut -d. -f3) + + case "${{ inputs.bump }}" in + major) + MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)); PATCH=0 + ;; + patch) + PATCH=$((PATCH + 1)) + ;; + esac + + NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}" + echo "새 태그: $NEW_TAG" + echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT" + + - name: 태그 생성 및 push (→ prod-cd.yml 트리거) + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag "${{ steps.version.outputs.new_tag }}" + git push origin "${{ steps.version.outputs.new_tag }}" + + - name: 요약 + run: echo "## ${{ steps.version.outputs.new_tag }} 태그 push 완료 — RUNNECT-PROD-CD가 곧 트리거됩니다." >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index 0ffca49..3f94494 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,14 @@ | staging (Render) | `main` push | 자동 배포 | | 상용 (AWS CodeDeploy) | `v*` 형식의 git tag push | 수동 승격 | -merge → staging에서 자동 확인 → 문제 없으면 `git tag v1.x.x && git push origin v1.x.x`로 상용 배포. 버전은 느슨한 semver(기능 추가 minor, 버그 수정 patch)를 따른다. +merge → staging에서 자동 확인 → 문제 없으면 상용 배포. 태그를 로컬에서 직접 만들 필요 없이, **GitHub Actions의 `Promote to Production` workflow**(`workflow_dispatch`)를 실행하면 다음 semver 태그를 자동 계산해 push까지 해준다. + +```bash +# Actions 탭에서 "Promote to Production" → Run workflow 버튼으로도 가능 +gh workflow run promote-to-prod.yml -f bump=patch # patch | minor | major +``` + +이 태그 push가 `prod-cd.yml`의 트리거를 실행시켜 상용 배포로 이어진다. ### 🚩 Feature Flag