-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (70 loc) · 2.39 KB
/
backend-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
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
name: Backend CD
on:
push:
branches:
- develop
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@master
with:
token: ${{ secrets.ACTION_TOKEN }}
submodules: true
- name: Update submodules
run: git submodule update --remote
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- 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-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew :core:core-api:build
- name: Make zip file
run: |
mkdir deploy
cp ./docker/docker-compose.yml ./deploy/
cp ./appspec.yml ./deploy/
cp ./scripts/deploy.sh ./deploy/
cp ./docker/Dockerfile ./deploy/
cp ./core/core-api/build/libs/*.jar ./deploy/
zip -r -qq -j ./spring-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 \
./spring-build.zip s3://melly-s3
- name: Code Deploy
run: aws deploy create-deployment --application-name melly-deploy
--deployment-config-name CodeDeployDefault.HalfAtATime
--deployment-group-name melly-deploy-group
--s3-location bucket=melly-s3,bundleType=zip,key=spring-build.zip
- name: Send Slack Message
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: melly_deploy_bot
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
mention: here
if_mention: failure, cancelled
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()