-
-
Notifications
You must be signed in to change notification settings - Fork 3
다시 릴리즈 PR 사용하도록 Tagging 워크플로우 변경 #727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| 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 | ||
|
|
||
| - 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 | ||
This file contains hidden or 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
| 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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을 진행해야 정상동작 할 것으로 예상됩니다.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
예상과 다르게 정상동작하는거 같네요 신기하네요
There was a problem hiding this comment.
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 영역으로 넘어오지 않는 변경사항을 버리지 않거든요. 아무래도 옵션 이름 때문에 오해하기 쉬울 것 같아서 주석을 추가해놓겠습니다.