Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release PR ⬆️

on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type (patch/minor/major)"
required: true
type: choice
default: patch
options:
- patch
- minor
- major

jobs:
release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: fregante/setup-git-user@v2

- name: Bump version
run: npm version ${{ inputs.bump }} --no-git-tag-version
Copy link
Contributor

@hyoseong1994 hyoseong1994 Jan 7, 2026

Choose a reason for hiding this comment

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

bump version가 main에서 이루어지는거같은데 그러면 origin/main 이랑 달라질것 같습니다.
스크립트 중에 git switch -c "$BRANCH" origin/main 이 부분 이후에 bump version을 진행해야 정상동작 할 것으로 예상됩니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

예상과 다르게 정상동작하는거 같네요 신기하네요

Copy link
Member Author

Choose a reason for hiding this comment

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

@hyoseong1994 님, --no-git-tag-version 옵션은 npm version 명령어가 기본적으로 하는 커밋과 태그 생성을 모두 건너뛰고, package.json 내의 버전만 수정합니다. 즉, 파일 변경사항이 Working directory에 남아있어요. Git은 브랜치를 바꿔도 Stage 영역으로 넘어오지 않는 변경사항을 버리지 않거든요. 아무래도 옵션 이름 때문에 오해하기 쉬울 것 같아서 주석을 추가해놓겠습니다.


- name: Create Pull Request
id: create-pr
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=$(jq -r '.version' package.json)
BRANCH="release/v${VERSION}"
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"

LAST_TAG=$(git describe --tags --abbrev=0)
BODY=$(git log ${LAST_TAG}..HEAD --oneline | grep -oE "#[0-9]+" | sort -u | sed 's/^/- /')

git switch -c "$BRANCH" origin/main
git commit -am "release: v${VERSION}"
git push origin "$BRANCH"

gh pr create --title "release: v${VERSION}" --body "$BODY"

- name: Cleanup on failure
if: failure()
run: git push origin --delete "${{ steps.create-pr.outputs.branch }}" || true
33 changes: 11 additions & 22 deletions .github/workflows/tagging.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
name: Tagging 🏷️

on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type (patch/minor/major)"
required: true
type: choice
default: patch
options:
- patch
- minor
- major
pull_request:
types: [closed]
branches: [main]

jobs:
create-tag:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6

- uses: fregante/setup-git-user@v2

- name: Bump version
run: npm version ${{ inputs.bump }}

- name: Push changes
run: git push --follow-tags

- name: Draft release
- name: Create tag and release
env:
GH_TOKEN: ${{ github.token }}
run: |
NEW_VERSION="v$(jq -r '.version' package.json)"
gh release create $NEW_VERSION --draft --generate-notes
VERSION="v$(jq -r '.version' package.json)"

git tag "$VERSION"
git push origin "$VERSION"

gh release create "$VERSION" --draft --generate-notes