-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (51 loc) · 1.81 KB
/
github-actions.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
on:
push:
branches:
- main
env:
CODE_DEPLOY_APPLICATION_NAME: CatchRoom-deploy
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: CatchRoom-Codedeployment
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'adopt' # or 'temurin' or 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
# 전송할 파일을 담을 디렉토리 생성
- name: Make Directory for deliver
run: mkdir deploy
# Jar 파일 copy
- name: Copy Jar
run: cp ./build/libs/*.jar ./deploy/
- name: Copy appspec and deploy script
run: |
cp ./appspec.yml ./deploy/
cp ./deploy.sh ./deploy/
# 압축파일 형태로 전달
- name: Make zip file
run: zip -r -qq -j ./$GITHUB_SHA.zip ./deploy
# S3 Bucket으로 Upload
- name: Deploy
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2
# S3 Bucket으로 copy
- name: Deliver to AWS S3
run: aws s3 cp --region ap-northeast-2 --acl private ./$GITHUB_SHA.zip s3://catchroom-bucket/
- name: Code Deploy
run: |
aws deploy create-deployment \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=catchroom-bucket,bundleType=zip,key=$GITHUB_SHA.zip