Skip to content

[BUILD] main 머지 시 자동 릴리스 버전 태깅 워크플로우 추가#115

Merged
dgh06175 merged 1 commit into
developfrom
be/110-feat-dev-서버-prod-서버-분리
Mar 10, 2026

Hidden character warning

The head ref may contain hidden characters: "be/110-feat-dev-\uc11c\ubc84-prod-\uc11c\ubc84-\ubd84\ub9ac"
Merged

[BUILD] main 머지 시 자동 릴리스 버전 태깅 워크플로우 추가#115
dgh06175 merged 1 commit into
developfrom
be/110-feat-dev-서버-prod-서버-분리

Conversation

@dgh06175

Copy link
Copy Markdown
Contributor

📄 작업 내용 요약

  • main 대상 PR에 RELEASE 라벨이 정확히 1개 있는지 검사하는 GitHub Actions 워크플로우를 추가했습니다.
  • main 머지 시 PR 라벨(RELEASE: MAJOR / MINOR / PATCH)에 따라 다음 semantic version 태그를 자동 생성하는 워크플로우를 추가했습니다.
  • GitHub Release가 자동 생성되도록 설정했습니다.
  • PR 템플릿에 release 라벨 선택 안내를 추가했습니다.

🏷️ Release 라벨

  • RELEASE: PATCH

📎 Issue 번호

@dgh06175 dgh06175 self-assigned this Mar 10, 2026
@dgh06175 dgh06175 added the feat 기능 개발 label Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 12:16
@dgh06175 dgh06175 added the BE 백엔드 label Mar 10, 2026
@dgh06175 dgh06175 added this to Gulab Mar 10, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Gulab Mar 10, 2026
@dgh06175 dgh06175 changed the title build: 메인 브랜치 병합 시 릴리스를 생성하고 릴리스 레이블을 검증하는 워크플로우 추가 [BUILD] main 머지 시 자동 릴리스 버전 태깅 워크플로우 추가 Mar 10, 2026
@dgh06175 dgh06175 merged commit d0b1748 into develop Mar 10, 2026
4 of 8 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Gulab Mar 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Actions automation to enforce release labeling on main PRs and to create a semver-based GitHub Release when a main PR is merged.

Changes:

  • Add a workflow that requires exactly one RELEASE: {MAJOR|MINOR|PATCH} label on PRs targeting main.
  • Add a workflow that, on merge to main, computes the next v<major>.<minor>.<patch> tag from the PR’s release label and creates a GitHub Release.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/require-release-label-for-main.yml Enforces exactly one release label on PRs targeting main.
.github/workflows/create-release-on-main-merge.yml On merged PRs to main, derives the next semver tag and creates a GitHub Release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +58 to +66
latest_tag="$(git tag --list 'v*' --sort=-version:refname | head -n 1)"
if [ -z "${latest_tag}" ]; then
latest_tag="v0.0.0"
fi

version="${latest_tag#v}"
IFS='.' read -r major minor patch_version <<EOF
${version}
EOF

Copilot AI Mar 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest_tag is selected from all v* tags, but the parsing logic assumes strict v<major>.<minor>.<patch> numeric format. If the repo ever has tags like v1.2.3-alpha, v1.2, or any non-numeric v* tag, the read + arithmetic will fail and the workflow will error. Consider filtering to tags that match ^v[0-9]+\.[0-9]+\.[0-9]+$ (or validating and failing with a clear message) before computing the next version.

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +116
if gh release view "${NEW_TAG}" --repo "${REPOSITORY}" >/dev/null 2>&1; then
echo "Release ${NEW_TAG} already exists. Skipping."
exit 0
fi

notes_file="$(mktemp)"
cat <<EOF > "${notes_file}"
Release type: ${RELEASE_LABEL}
Previous tag: ${PREVIOUS_TAG}

Merged pull request:
- #${PR_NUMBER} ${PR_TITLE}
EOF

gh release create "${NEW_TAG}" \
--repo "${REPOSITORY}" \
--target "${MERGE_COMMIT_SHA}" \
--title "${NEW_TAG}" \
--notes-file "${notes_file}"

Copilot AI Mar 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job can race on fast consecutive merges: two runs may read the same latest_tag, compute the same new_tag, then one gh release create will fail. Consider adding a workflow/job concurrency group to serialize release creation and/or checking for existing tag (refs/tags/${NEW_TAG}) in addition to gh release view before attempting creation.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +6
name: Require release label for main

on:
pull_request:
branches:
- main

Copilot AI Mar 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says the PR template was updated to include release label selection guidance, but this PR only adds workflow files and the existing .github/PULL_REQUEST_TEMPLATE.md still lacks that guidance. Either include the template change in this PR or update the description to avoid a mismatch.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BE 백엔드 feat 기능 개발

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants