-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (43 loc) · 1.57 KB
/
dev-cd.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
name: gohigher-backend-dev-cd
on:
push:
branches:
- develop
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Checkout source code
uses: actions/checkout@v4
- name: Set Encryption Key
run: |
echo "encryption-key: $ENCRYPTION_KEY" >> $RESOURCE_PATH
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
RESOURCE_PATH: './bootstrap/src/main/resources/application.yml'
- name: Change gradlew permission
run: sudo chmod 755 gradlew
- name: Make Jar File
run: ./gradlew bootJar
- name: Make Zip File
run: zip -qq -r ./$GITHUB_SHA.zip .
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET_KEY }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://gohigher-backend-cd-bucket/backend/$GITHUB_SHA.zip
- name: Code Deploy To EC2 instance
run: aws deploy create-deployment
--application-name gohigher-backend-cd
--deployment-config-name CodeDeployDefault.AllAtOnce
--deployment-group-name gohigher-backend-cd
--s3-location bucket=gohigher-backend-cd-bucket,bundleType=zip,key=backend/$GITHUB_SHA.zip