Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 배포 스크립트 수정 #20

Merged
merged 4 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: BackEnd - CI/CD

on:
pull_request:
branches: [ "main","develop" ]
push:
branches: [ "develop" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
# JDK를 17 버전으로 셋팅한다.
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# Gradle을 캐싱한다 -> 빌드 속도가 증가하는 효과가 있다.
- name: Gradle 캐싱
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

# 프로젝트 저장소에 업로드하면 안되는 설정 파일들을 만들어줍니다.
- name: Make application.yml
run: |
# src/main 으로 경로를 이동합니다.
cd ./src/main
# src/main 경로에 resources 폴더를 만들어줍니다.
mkdir resources
cd ./resources
# 필요한 yml 파일들을 만들어줍니다.
touch ./application-dev.yml
# 등록해둔 Github Secrets의 내용을 이용해서 yml 파일의 내용을 써줍니다.
echo "$APPLICATION_DEV" > ./application-dev.yml
env:
APPLICATION_DEV: ${{ secrets.APPLICATION_DEV }}
shell: bash

- name: Gradle 권한 부여
run: chmod +x gradlew

- name: Gradle로 빌드 실행
run: ./gradlew bootjar

- name: Discord 알림 봇
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
11 changes: 9 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ name: BackEnd - CI/CD

on:
pull_request:
types: [ closed ]
branches: [ "develop" ]

permissions:
contents: read

jobs:
build:

deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -96,3 +97,9 @@ jobs:
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name meeteam-app
--s3-location bucket=meeteam-backend-bucket,bundleType=zip,key=spring-build.zip

- name: Discord 알림 봇
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
Loading