✏️ 인증번호 전송 api 통합 (#46) #21
This file contains 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
name: Continuous Deployment | |
on: | |
push: | |
branches: [ "dev" ] | |
workflow_dispatch: | |
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 | |
permissions: | |
contents: read | |
jobs: | |
deployment: | |
runs-on: ubuntu-20.04 | |
steps: | |
# 1. Compare branch 코드 내려 받기 | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.push.base_ref }} | |
# 2. 자바 환경 설정 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# 3. Build Gradle | |
- name: Build Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew build --stacktrace --info -x test | |
shell: bash | |
# 4. Docker 이미지 build 및 push | |
- name: docker build and push | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t pennyway/pennyway-was . | |
docker push pennyway/pennyway-was | |
# 5. AWS SSM을 통한 Run-Command (Docker 이미지 pull 후 docker-compose를 통한 실행) | |
- name: AWS SSM Send-Command | |
uses: peterkimzz/aws-ssm-send-command@master | |
id: ssm | |
with: | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
instance-ids: ${{ secrets.AWS_DEV_INSTANCE_ID }} | |
working-directory: /home/ubuntu | |
command: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker system prune -a -f | |
docker pull pennyway/pennyway-was | |
docker-compose up -d |