Add is-checked field (#177) #17
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: [ "main" ] | |
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: | |
develop-deploy: | |
runs-on: ubuntu-22.04 | |
env: | |
IMAGE_TAG: ${{github.sha}} | |
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' | |
# yml 파일 생성 | |
- name: Set up application.yml | |
run: | | |
cd ./src/main/resources | |
touch ./application.yml | |
echo "${{ secrets.APPLICATION }}" > ./application.yml | |
touch ./application-dev.yml | |
echo "${{ secrets.APPLICATION_DEV }}" > ./application-dev.yml | |
touch ./application-prod.yml | |
echo "${{ secrets.APPLICATION_TEST }}" > ./application-test.yml | |
touch ./application-test.yml | |
echo "${{ secrets.APPLICATION_PROD }}" > ./application-prod.yml | |
mkdir ./firebase | |
shell: bash | |
# Firebase를 위한 JSON 파일 생성 | |
- name: Create Json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "./src/main/resources/firebase/gifthub-production-3d052-firebase-adminsdk-zkstv-377ec5747b.json" | |
json: ${{ secrets.FIREBASE_PRODUCTION_JSON }} | |
# Docker 이미지 build 및 push | |
- name: docker build and push | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
pwd | |
ls -al | |
docker build -t repl4242/gifthub-was:${{env.IMAGE_TAG}} -f production/Dockerfile . | |
docker push repl4242/gifthub-was:${{env.IMAGE_TAG}} | |
# 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_PROD_INSTANCE_ID }} | |
working-directory: /home/ubuntu | |
command: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker system prune -a -f | |
docker pull repl4242/gifthub-was:${{env.IMAGE_TAG}} | |
IMAGE_TAG=${{env.IMAGE_TAG}} docker-compose -f docker-compose.yml -f docker-compose.prod.yml up --build |