Skip to content

Revert "[BE] release: 백엔드 운영 서버 배포 v1.0.0" #3

Revert "[BE] release: 백엔드 운영 서버 배포 v1.0.0"

Revert "[BE] release: 백엔드 운영 서버 배포 v1.0.0" #3

Workflow file for this run

name: Backend production CI/CD
on:
workflow_dispatch:
pull_request:
branches: [ main ]
types: [ closed ]
paths: backend/**
permissions:
contents: read
jobs:
build-and-upload:
if: github.event.pull_request.merged
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: 테스트 환경변수 설정
run: |
echo "TEST_JWT_SECRET_KEY=${{ secrets.TEST_JWT_SECRET_KEY }}" >> $GITHUB_ENV
echo "TEST_JWT_EXPIRE_LENGTH=${{ secrets.TEST_JWT_EXPIRE_LENGTH }}" >> $GITHUB_ENV
- name: gradlew 실행 권한 부여
run: chmod +x gradlew
working-directory: backend
- name: Gradle build 시작
run: ./gradlew clean build
working-directory: backend
- name: jar 파일 artifact에 업로드
uses: actions/upload-artifact@v3
with:
name: BackendApplication
path: backend/build/libs/mapbefine.jar
deploy:
runs-on: [ self-hosted, prod ]
needs: build-and-upload
if: github.event.pull_request.merged
steps:
- name: 구버전 jar 파일 삭제
run: rm -rf /home/ubuntu/backend/build/*.jar
- name: jar파일 artifact에서 다운로드
uses: actions/download-artifact@v3
with:
name: BackendApplication
path: /home/ubuntu/backend/build/
- name: 배포하기
run: /home/ubuntu/backend/deploy.sh
- name: 슬랙 메시지 보내기
uses: 8398a7/action-slack@v3
with:
mention: 'here'
if_mention: always
status: ${{ job.status }}
fields: workflow,job,commit,message,ref,author,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()