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

[#47] Github Actions에 application.yml에 Github Secrets의 값을 끼워 넣어주는 step 추가 #48

Merged
merged 3 commits into from
May 3, 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
17 changes: 14 additions & 3 deletions .github/workflows/dev-deploy.yml → .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 1. 워크 플로 이름 지정
name: HappinesSQL
name: HappinesSQL CI/CD

# 2. 워크플로가 시작될 조건 지정
on:
pull_request:
types: [closed]
types: [ closed ]
workflow_dispatch:

jobs:
Expand All @@ -27,6 +27,17 @@ jobs:
run: chmod +x ./gradlew
shell: bash # 권한 부여

- name: Set Environment
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
cloud.aws.credentials.access-key: ${{ secrets.AWS_S3_ACCESS_KEY }}
cloud.aws.credentials.secret-key: ${{ secrets.AWS_S3_SECRET_KEY }}
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USER }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}

- name: Build with Gradle
run: ./gradlew clean build -x test
shell: bash # build 시작
Expand All @@ -47,7 +58,7 @@ jobs:
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions_dev deploy/.ebextensions
cp -r .ebextensions deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
# JPA
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${DB_HOST}
url: ${DB_HOST} # TODO: 나중에 환경변수 DB_URL로 변경
username: ${DB_USER}
password: ${DB_PASSWORD}
jpa:
Expand Down
Loading