-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (65 loc) · 2.62 KB
/
prod-server-deployer.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
name: prod-server-deployer
on:
push:
branches:
- chore/DDING-001
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set yaml file
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{secrets.DB_URL}}
spring.datasource.username: ${{secrets.DB_USERNAME}}
spring.datasource.password: ${{secrets.DB_PASSWORD}}
spring.s3.bucket: ${{secrets.BUCKET_NAME}}
sprig.s3.access-key: ${{secrets.AWS_ACCESS_KEY_ID}}
sprig.s3.secret-key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
cloud.aws.region.static: ${{secrets.AWS_DEFAULT_REGION}}
jwt.secret: ${{secrets.JWT_SECRET}}
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew clean build
shell: bash
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00" # 한국 시간에 맞추기 위함
# grandle build를 통해 만들어진 jar를 beanstalk에 배포하기 위한 zip 파일로 만드는 것
- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r promtail deploy/promtail
cp -r nodeexporter deploy/nodeexporter
cp -r .ebextensions deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
# Beanstalk Deploy 플러그인 사용
- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} # github secrets로 등록한 값 사용
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # github secrets로 등록한 값 사용
application_name: ddingdong-dev # EB application 이름
environment_name: ddingdong-dev-env # EB environment 이름
version_label: Github Action-${{steps.current-time.outputs.formattedTime}} # 배포 버전은 타임스탬프를 이용하여 구분
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_environment_recovery: 300
- name: Test with Gradle
run: ./gradlew test --no-daemon