-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (80 loc) · 3.16 KB
/
deploy.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: DPlus-webservice
on:
push:
branches:
- main
workflow_dispatch:
env:
S3_BUCKET_NAME: dplus-jar-real
PROJECT_NAME: TeamDplus-code
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Set Yaml-1
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-real1.yml
env:
spring.datasource.url: ${{ secrets.RDS_HOST }}
spring.datasource.username: ${{ secrets.RDS_USERNAME }}
spring.datasource.password: ${{ secrets.RDS_PASSWORD }}
cloud.aws.s3.bucket: ${{secrets.AWS_S3_BUCKET_NAME}}
cloud.aws.credentials.accessKey: ${{secrets.AWS_S3_ACCESS_KEY}}
cloud.aws.credentials.secretKey: ${{secrets.AWS_S3_SECRET_KEY}}
jwt.secret: ${{ secrets.JWT_SECRET }}
- name: Set Yaml-2
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-real2.yml
env:
spring.datasource.url: ${{ secrets.RDS_HOST }}
spring.datasource.username: ${{ secrets.RDS_USERNAME }}
spring.datasource.password: ${{ secrets.RDS_PASSWORD }}
cloud.aws.s3.bucket: ${{secrets.AWS_S3_BUCKET_NAME}}
cloud.aws.credentials.accessKey: ${{secrets.AWS_S3_ACCESS_KEY}}
cloud.aws.credentials.secretKey: ${{secrets.AWS_S3_SECRET_KEY}}
jwt.secret: ${{ secrets.JWT_SECRET }}
- name: Build with Gradle
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: build
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss # (1)
utcOffset: "+09:00"
- name: Show Current Time
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}"
shell: bash
- name: Make Directory
run: mkdir deploy
# Jar 파일 복사
- name: Copy Jar
run: cp ./build/libs/*.jar ./deploy/
- name: Copy script
run: cp ./scripts/*.sh ./deploy/
- name: Copy appspec.yml
run: cp appspec.yml ./deploy/
- name: Make zip file
run: zip -r -qq -j ./$GITHUB_SHA.zip ./deploy/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name dplus-deploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name develop --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$GITHUB_SHA.zip