-
Notifications
You must be signed in to change notification settings - Fork 5
43 lines (43 loc) · 1.65 KB
/
Copy pathdeploy.yml
File metadata and controls
43 lines (43 loc) · 1.65 KB
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
name: CICD Test
run-name: Running
on:
push:
branches:
- release
- 'release/**'
env:
AWS_REGION: ap-northeast-2
AWS_S3_BUCKET: hanghaetinders3
AWS_CODE_DEPLOY_APPLICATION: hanghaetinder
AWS_CODE_DEPLOY_GROUP: hanghaetinder-group
jobs:
build-with-gradle:
runs-on: ubuntu-20.04
steps:
- name: production 브랜치로 이동
uses: actions/checkout@v3
with:
ref: release
- name: JDK 17 설치
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: gradlew에 권한 부여
run: chmod +x ./gradlew
- name: jasypt key주입
run: echo ${{secrets.JASYPT}} | base64 --decode >> ./src/main/resources/application.yml
- name: View application.yml
run: cat ./src/main/resources/application.yml
- name: 프로젝트 빌드
run: ./gradlew clean build -x test
- name: AWS credential 설정
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.CICD_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.CICD_SECRET_KEY }}
- name: S3에 업로드
run: aws deploy push --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://$AWS_S3_BUCKET/cicdtest/$GITHUB_SHA.zip --source .
- name: EC2에 배포
run: aws deploy create-deployment --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=$AWS_S3_BUCKET,key=cicdtest/$GITHUB_SHA.zip,bundleType=zip