Skip to content

Merge pull request #69 from f-lab-edu/feature/68-instructiontest #42

Merge pull request #69 from f-lab-edu/feature/68-instructiontest

Merge pull request #69 from f-lab-edu/feature/68-instructiontest #42

Workflow file for this run

name: CD
on:
push:
branches: [ "master" ]
permissions:
contents: read
jobs:
CD:
runs-on: ubuntu-latest
# 작업 실행단계
steps:
# 체크아웃 및 JDK 세팅
- name : Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
# Gradle 권한 부여
- name : Grant Execute permission for gradlew
run: chmod +x gradlew
shell: bash
# application.yml 파일 생성
- name: Make application.yml
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_YAML }}" | base64 --decode > ./application.yml
shell: bash
# Pinpoint License 입력
- name: Set Pinpoint License
run: |
cd ./pinpoint-agent-2.2.3-NCP-RC1
echo "${{ secrets.PINPOINT_LICENSE }}" >> pinpoint.license
shell: bash
# Gradle 빌드 (테스트 제외)
- name: Build with Gradle
run: ./gradlew clean build -x test
shell: bash
# DockerFile 이미지 작성 및 Docker Repository 업로드
- name: Docker build & Docker push
run: |
docker login -u ${{ secrets.USERNAME }} -p ${{ secrets.PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.USERNAME }}/modoospace .
docker push ${{ secrets.USERNAME }}/modoospace
# 서버 접속 및 애플리케이션 실행
- name: WAS access & deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WAS_HOST }}
username: ${{ secrets.WAS_USERNAME }}
password: ${{ secrets.WAS_PASSWORD }}
port: ${{ secrets.WAS_SSH_PORT }}
script: |
docker stop modoocontainer
docker rm modoocontainer
docker pull ${{ secrets.USERNAME }}/modoospace
docker run -d -p 8080:8080 --name modoocontainer ${{ secrets.USERNAME }}/modoospace