Skip to content

Api: โœ๏ธ ์›”๋ณ„ ์ง€์ถœ๋‚ด์—ญ ์กฐํšŒ์‹œ ๋ฐœ์ƒํ•˜๋Š” N+1 ๋ฌธ์ œ ๊ฐœ์„  #17

Api: โœ๏ธ ์›”๋ณ„ ์ง€์ถœ๋‚ด์—ญ ์กฐํšŒ์‹œ ๋ฐœ์ƒํ•˜๋Š” N+1 ๋ฌธ์ œ ๊ฐœ์„ 

Api: โœ๏ธ ์›”๋ณ„ ์ง€์ถœ๋‚ด์—ญ ์กฐํšŒ์‹œ ๋ฐœ์ƒํ•˜๋Š” N+1 ๋ฌธ์ œ ๊ฐœ์„  #17

name: Tag and Release
on:
pull_request:
types: [ closed ]
jobs:
extract-info:
# PR์ด merge ๋˜์—ˆ์„ ๋•Œ๋งŒ ์‹คํ–‰ (merge๊ฐ€ ์•„๋‹Œ close๋Š” ์ œ์™ธ)
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
outputs:
module: ${{ steps.module_prefix.outputs.module }}
tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: Checkout PR
uses: actions/checkout@v4
# PR ์ œ๋ชฉ์œผ๋กœ ๋ถ€ํ„ฐ ๋ชจ๋“ˆ๋ช… ์ถ”์ถœ (ex. Api, Batch, Admin, Socket)
- name: extract PR info
id: module_prefix
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
echo "PR title : $PR_TITLE"
if [[ "$PR_TITLE" =~ ^(Api|Batch|Admin|Socket): ]]; then
PREFIX="${BASH_REMATCH[1]}"
echo "Prefix: $PREFIX"
echo "module=$PREFIX" >> $GITHUB_OUTPUT
else
echo "PR title does not match the pattern"
exit 1
fi
# ๋ณ‘ํ•ฉ๋œ PR commit ์ด๋ ฅ์œผ๋กœ ๋ถ€ํ„ฐ ๋ฒ„์ „ ์ถ”์ถœ (ex. v1.0.0)
- name: version and tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
release_branches: main,dev.*
custom_release_rules: release:major, feat:minor:Features, refactor:minor:Refactoring, fix:patch:Bug Fixes, hotfix:patch:Hotfixes, docs:patch:Documentation, style:patch:Styles, perf:patch:Performance Improvements, test:patch:Tests, ci:patch:Continuous Integration, chore:patch:Chores, revert:patch:Reverts
tag_prefix: '${{ steps.module_prefix.outputs.module }}-v'
# ์ถ”์ถœ๋œ ๋ฒ„์ „ ๋ฐ ๋ณ€๊ฒฝ ์ด๋ ฅ ๋กœ๊ทธ ์ถœ๋ ฅ
- name: check output
run: |
echo "new_tag : ${{ steps.tag_version.outputs.new_tag }}"
echo "change_log : ${{ steps.tag_version.outputs.changelog }}"
# GitHub Release ์ƒ์„ฑ
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
call-external-api-deploy:
needs: extract-info
if: ${{ needs.extract-info.outputs.module == 'Api' }}
uses: ./.github/workflows/deploy-external-api.yml
secrets: inherit
with:
tags: ${{ needs.extract-info.outputs.tag }}
call-batch-deploy:
needs: extract-info
if: ${{ needs.extract-info.outputs.module == 'Batch' }}
uses: ./.github/workflows/deploy-batch.yml
secrets: inherit
with:
tags: ${{ needs.extract-info.outputs.tag }}