forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 4
53 lines (43 loc) · 1.46 KB
/
ci.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
name: CI
on:
push:
branches:
- backend
env:
AWS_REGION: ap-northeast-2
AWS_S3_ACCESS_KEY: ${{secrets.AWS_S3_ACCESS_KEY}}
AWS_S3_SECRET_KEY: ${{secrets.AWS_S3_SECRET_KEY}}
AWS_S3_BUCKET: ${{secrets.AWS_S3_BUCKET}}
JWT_SECRET: ${{secrets.JWT_SECRET}}
jobs:
build:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./backend
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: JDK 17 setup
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: gradlew chmod
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew clean build --exclude-task test
- name: AWS credential setting
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: upload to s3
run: aws deploy push --application-name dodo-codedeploy --ignore-hidden-files --s3-location s3://my-dodo-bucket/build.zip --source .
- name: EC2 deploy
run: aws deploy create-deployment
--application-name dodo-codedeploy
--deployment-config-name CodeDeployDefault.AllAtOnce
--deployment-group-name dodo-group
--s3-location bucket=my-dodo-bucket,bundleType=zip,key=build.zip