-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.45 KB
/
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
name: deploy
on:
push:
branches: [ "main" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Create Secret Files
run: |
mkdir ./src/main/resources/secret
echo "${{ secrets.APPLICATION_PROD_CONFIG }}" > ./src/main/resources/secret/application-prod-config.yml
- name: Build Project
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x test
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Zip Project Files
run: zip -r application.zip .
- name: Upload to AWS S3
run: |
aws s3 cp --acl private application.zip s3://${{ secrets.S3_BUCKET_NAME }}/$GITHUB_SHA.zip
- name: Call CodeDeploy
run: |
aws deploy create-deployment \
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} \
--deployment-group-name ${{ secrets.CODE_DEPLOY_GROUP_NAME }} \
--region ap-northeast-2 \
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=$GITHUB_SHA.zip