-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (65 loc) · 2.31 KB
/
develop-deploy.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
name: Develop Branch CI
on:
push:
branches: [ "setting/#48" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# JDK 설정
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# 환경 변수 파일 생성
- name: Set environment values for main application
run: |
cd ./src/main/resources
touch ./env.properties
echo "${{ secrets.ENV }}" > ./env.properties
shell: bash
- name: Set environment values for test
run: |
cd ./src/test/resources
touch ./env.properties
echo "${{ secrets.TEST_ENV }}" > ./env.properties
shell: bash
# Gradle에 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Gradle test
- name: Test with Gradle
run: ./gradlew test
# Gradle build
- name: Build Gradle
run: ./gradlew build
# 압축 파일 만들기
- name: Make zip file
run: |
mkdir develop-deploy
cp ./src/main/resources/env.properties ./develop-deploy/.env
cp ./docker-compose.blue.yml ./develop-deploy/
cp ./docker-compose.green.yml ./develop-deploy/
cp ./appspec.yml ./develop-deploy/
cp ./Dockerfile ./develop-deploy/
cp ./scripts/*.sh ./develop-deploy/
cp ./build/libs/*.jar ./develop-deploy/
zip -r -qq -j ./munecting.zip ./develop-deploy
# AWS 접속
- 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
# S3에 저장
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./munecting.zip s3://code-deploy-munecting
# Code Deploy 실행
- name: Code Deploy
run: aws deploy create-deployment --application-name munecting-deploy
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name munecting-deploy-group
--s3-location bucket=code-deploy-munecting,bundleType=zip,key=munecting.zip