-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (60 loc) · 2.1 KB
/
Copy pathcontinuous-deployment-dev.yml
File metadata and controls
71 lines (60 loc) · 2.1 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
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
name: continuous deployment (dev)
on:
push:
branches:
- dev
permissions:
id-token: write
contents: read
env:
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: ject-bucket
CODE_DEPLOY_APPLICATION_NAME: ject-apply-deployer
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: actions-deployer
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
- name: AWS credential 설정
uses: aws-actions/configure-aws-credentials@v4
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: S3에서 설정파일 복사
run: |
aws s3 cp s3://ject-bucket/properties/application-dev.yml \
./src/main/resources/application-dev.yml
- name: gradle 실행 권한 부여
run: chmod +x ./gradlew
- name: gradle 빌드
run: ./gradlew clean build -x test --no-daemon
- name: Upload to AWS S3
run: |
aws deploy push \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--ignore-hidden-files \
--s3-location s3://$S3_BUCKET_NAME/apps/$GITHUB_SHA.zip \
--source .
- name: Deploy to AWS EC2 from S3
run: |
aws deploy create-deployment \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=apps/$GITHUB_SHA.zip,bundleType=zip