동의여부 삭제 (#84) #18
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 (dev) | |
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: | |
develop-deploy: | |
runs-on: ubuntu-22.04 | |
env: | |
IMAGE_TAG: ${{ github.sha }} | |
REPO: ${{ secrets.DOCKER_REPOSITORY }} | |
SPRING_PROFILE: dev | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.push.base_ref }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build Springboot Docker image | |
run: ./gradlew clean bootBuildImage --imageName=$REPO:$IMAGE_TAG | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Publish Docker image | |
run: | | |
docker push $REPO:$IMAGE_TAG | |
- name: Deploy Docker image in WAS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.WAS_DEV_HOST }} | |
username: ${{ secrets.WAS_DEV_USERNAME }} | |
key: ${{ secrets.WAS_DEV_SSH_KEY_PAIR }} | |
port: ${{ secrets.WAS_DEV_SSH_PORT }} | |
timeout: 40s | |
script: | | |
echo "############# PULL DOCKER IMAGE #############" | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker pull ${{env.REPO}}:${{env.IMAGE_TAG}} | |
echo "############# RUN DEPLOY SCRIPT #############" | |
cd ${{ vars.DEPLOY_DEV_SCRIPT_PATH }} | |
sh deploy-dev.sh ${{env.SPRING_PROFILE}} ${{env.IMAGE_TAG}} | |
- name: Send Slack message | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | |
if_mention: failure,cancelled | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_BACKEND_TEAM_URL }} # required | |
if: always() # Pick up events even if the job fails or is canceled. |