Skip to content

Commit

Permalink
[BE] 백엔드 Github Action CD 구현 (#743)
Browse files Browse the repository at this point in the history
* feat: backend deploy yml 작성

* refactor: frontend CD ubuntu 버전 지정

* fix: workflow 이름 변경

* fix: secret 이름 및 디렉토리 변경
  • Loading branch information
jaehee329 authored Nov 22, 2023
1 parent d0da397 commit 5df705e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/backend-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: backend-deploy

on:
workflow_dispatch:

defaults:
run:
working-directory: ./backend

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'

- name: Build App
run: ./gradlew bootJar

- name: SCP
uses: appleboy/scp-action@master
with:
username: ubuntu
host: ${{ secrets.HOST_WAS1 }}
key: ${{ secrets.PRIVATE_KEY_WAS1 }}
source: "./backend/build/libs/*.jar"
target: "/home/ubuntu/backend"
strip_components: 3

- name: Deploy
uses: appleboy/ssh-action@master
with:
username: ubuntu
host: ${{ secrets.HOST_WAS1 }}
key: ${{ secrets.PRIVATE_KEY_WAS1 }}
script: |
sudo /home/ubuntu/deploy/deploy.sh
- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Github Action # default: 8398a7@action-slack
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always()
4 changes: 2 additions & 2 deletions .github/workflows/frontend-develop-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: frontend-build-test
name: frontend-develop-deploy

on:
workflow_dispatch:
Expand All @@ -9,7 +9,7 @@ defaults:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/frontend-main-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: frontend-build-test
name: frontend-main-deploy

on:
workflow_dispatch:
Expand All @@ -9,7 +9,7 @@ defaults:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand Down

0 comments on commit 5df705e

Please sign in to comment.