Skip to content

Commit

Permalink
Api: 🐛 태그 생성 & 릴리즈 자동화 파이프라인 후 배포 workflows call (#101)
Browse files Browse the repository at this point in the history
* fix: 배포 파이프라인 이미지 빌드 버전 추가

* rename: run 이름 call-external-api-deploy로 변경

* chore: api & batch 모듈 workflow_call trigger 추가

* chore: tag 정보 inputs.tags로 수정

* test: 태그 생성 트리거 opened 추가

* test: merged 조건식 임시 제거

* fix: call 인자 전달 시 version -> tag 수정

* rename: batch cd 파이프라인 이름 수정

* chore: workflow_dispatch 제거

* chore: reuse workflow 호출 시 secret key 상속 옵션 추가

* chore: pr 병합 조건문 추가
  • Loading branch information
psychology50 authored Jun 1, 2024
1 parent 7c9d43f commit 8379b0e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 46 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/create-tag-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
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
Expand Down Expand Up @@ -56,4 +59,20 @@ jobs:
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
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 }}
31 changes: 8 additions & 23 deletions .github/workflows/deploy-batch.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
name: Continuous Deployment - External API
name: Continuous Deployment - Batch

on:
push:
tags:
- Batch-v*.*.*
workflow_dispatch:
workflow_call:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false
description: '배포할 Batch 모듈 태그 정보 (Batch-v*.*.*)'
required: true
type: string

permissions:
contents: read
Expand All @@ -42,7 +26,7 @@ jobs:
- name: Get Version
id: get_version
run: |
RELEASE_VERSION_WITHOUT_V="$(cut -d'v' -f2 <<< ${GITHUB_REF#refs/*/})"
RELEASE_VERSION_WITHOUT_V="$(cut -d'v' -f2 <<< ${{ inputs.tags }})"
echo "VERSION=$RELEASE_VERSION_WITHOUT_V" >> $GITHUB_OUTPUT
# 3. 자바 환경 설정
Expand All @@ -63,7 +47,8 @@ jobs:
- name: docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t pennyway/pennyway-batch ./pennyway-batch
docker build -t pennyway/pennyway-batch:${{ steps.get_version.outputs.VERSION }} ./pennyway-batch
docker build -t pennyway/pennyway-batch:latest ./pennyway-batch
docker push pennyway/pennyway-batch:${{ steps.get_version.outputs.VERSION }}
docker push pennyway/pennyway-batch:latest
Expand Down
29 changes: 7 additions & 22 deletions .github/workflows/deploy-external-api.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
name: Continuous Deployment - External API

on:
push:
tags:
- Api-v*.*.*
workflow_dispatch:
workflow_call:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false
description: '배포할 Api 모듈 태그 정보 (Api-v*.*.*)'
required: true
type: string

permissions:
contents: read
Expand All @@ -42,7 +26,7 @@ jobs:
- name: Get Version
id: get_version
run: |
RELEASE_VERSION_WITHOUT_V="$(cut -d'v' -f2 <<< ${GITHUB_REF#refs/*/})"
RELEASE_VERSION_WITHOUT_V="$(cut -d'v' -f2 <<< ${{ inputs.tags }})"
echo "VERSION=$RELEASE_VERSION_WITHOUT_V" >> $GITHUB_OUTPUT
# 3. 자바 환경 설정
Expand Down Expand Up @@ -71,7 +55,8 @@ jobs:
- name: docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t pennyway/pennyway-was ./pennyway-app-external-api
docker build -t pennyway/pennyway-was:${{ steps.get_version.outputs.VERSION }} ./pennyway-app-external-api
docker build -t pennyway/pennyway-was:latest ./pennyway-app-external-api
docker push pennyway/pennyway-was:${{ steps.get_version.outputs.VERSION }}
docker push pennyway/pennyway-was:latest
Expand Down

0 comments on commit 8379b0e

Please sign in to comment.