Skip to content

Batch: ๐Ÿ› ์ •๊ธฐ ํ‘ธ์‹œ ์•Œ๋ฆผ ๋ฐฐ์น˜ ์ฟผ๋ฆฌ ํ”ฝ์Šค & ItemReader ๊ธฐ๋Šฅ ์ˆ˜์ • #43

Batch: ๐Ÿ› ์ •๊ธฐ ํ‘ธ์‹œ ์•Œ๋ฆผ ๋ฐฐ์น˜ ์ฟผ๋ฆฌ ํ”ฝ์Šค & ItemReader ๊ธฐ๋Šฅ ์ˆ˜์ •

Batch: ๐Ÿ› ์ •๊ธฐ ํ‘ธ์‹œ ์•Œ๋ฆผ ๋ฐฐ์น˜ ์ฟผ๋ฆฌ ํ”ฝ์Šค & ItemReader ๊ธฐ๋Šฅ ์ˆ˜์ • #43

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 }}
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|Ignore): ]]; 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
release:
needs: extract-info
if: ${{ needs.extract-info.outputs.module != 'Ignore' }} # Ignore๋กœ ์‹œ์ž‘ํ•˜๋Š” PR์€ ํŒŒ์ดํ”„๋ผ์ธ ์ค‘๋‹จ
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
outputs:
tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: version and tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
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, cd:patch:Continuous Deployment, chore:patch:Chores, revert:patch:Reverts
tag_prefix: '${{ needs.extract-info.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, release ]
if: ${{ needs.extract-info.outputs.module == 'Api' }}
uses: ./.github/workflows/deploy-external-api.yml
secrets: inherit
with:
tags: ${{ needs.release.outputs.tag }}
call-batch-deploy:
needs: [ extract-info, release ]
if: ${{ needs.extract-info.outputs.module == 'Batch' }}
uses: ./.github/workflows/deploy-batch.yml
secrets: inherit
with:
tags: ${{ needs.release.outputs.tag }}