-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (64 loc) · 2.25 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
name: Deploy to Production
on:
push:
branches: [ "develop" ]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
steps:
## JDK 버전 : 17
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
## 빌드 시간 단축용 gradle 캐싱
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
## yml 파일 생성
- name: Set up yml file
env:
YAML_SECRET: ${{ secrets.APPLICATION_DEV_YML }}
YAML_DIR: src/main/resources
YAML_FILE_NAME: application-dev.yml
run: echo $YAML_SECRET | base64 --decode > $YAML_DIR/$YAML_FILE_NAME
## gradlew 권한 부여 및 빌드
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Make zip file
run: |
mkdir deploy
cp ./docker-compose.blue.yml ./deploy/
cp ./docker-compose.green.yml ./deploy/
cp ./appspec.yml ./deploy/
cp ./Dockerfile ./deploy/
cp ./scripts/*.sh ./deploy/
cp ./build/libs/*.jar ./deploy/
zip -r -qq -j ./chillin-build.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 \
./chillin-build.zip s3://chillin-bucket
- name: Code Deploy
run: aws deploy create-deployment --application-name chillin-codedeploy
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name chillin-deploy-group
--s3-location bucket=chillin-bucket,bundleType=zip,key=chillin-build.zip