-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (70 loc) ยท 2.69 KB
/
dev_deploy_beanstalk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: suppin dev CI/CD # Workflow ์ด๋ฆ
on:
pull_request:
branches:
- dev
types:
- closed
workflow_dispatch: # ์๋ ์คํ๋ ๊ฐ๋ฅํ๋๋ก
jobs:
build:
runs-on: ubuntu-latest # OS ํ๊ฒฝ ์ธํ
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'dev' # PR์ด Merge๋๊ณ , base branch๊ฐ dev์ผ ๋๋ง ์คํ
steps:
- name: Checkout
uses: actions/checkout@v2 # .github ๋๋ ํ ๋ฆฌ ํ์ ๊ณ์ธต์ ๋ชจ๋ ์ฝ๋ ํ์ธ
# java ์ค์น
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
# aws ํ๊ฒฝ๋ณ์ ์ค์
- name: Set Environment
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USER }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}
spring.datasource.driver-class-name: ${{ secrets.DB_DRIVER }}
jwt.token.secret: ${{ secrets.JWT_TOKEN_SECRET }}
jwt.token.expiration: ${{ secrets.ACCESS_EXPIRY_SECONDS }}
# gradlew ์คํ ๊ถํ ๋ถ์ฌ
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
# ํ
์คํธ๋ฅผ ์ ์ธํ ๋น๋ ์์
- name: Build with Gradle
run: ./gradlew build -x test
shell: bash
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD HH:mm:ss
utcOffset: '+09:00' # build ์์ ์ ์๊ฐ์ ๊ธฐ๋ก
- name: Show current time
run: echo "Current time is ${{ steps.current-time.outputs.time }}"
shell: bash
- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions_dev deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
# AWS Elastic Beanstalk ๋ฐฐํฌ
- name: BeanStalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }}
region: 'ap-northeast-2'
application_name: 'suppin-dev'
environment_name: 'Suppin-dev-env'
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
deployment_package: 'deploy/deploy.zip'
wait_for_deployment: false