-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (53 loc) ยท 1.83 KB
/
gradle.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
name: Java CI/CD with Gradle and AWS CodeDeploy
on:
push:
branches:
- main
permissions:
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Grant execute permission for scripts
run: chmod +x ./scripts/*.sh
- name: Build with Gradle
run: ./gradlew clean build -x test
- name: Prepare artifacts for deployment
run: |
mkdir -p before-deploy
cp scripts/*.sh before-deploy/
cp appspec.yml before-deploy/
cp build/libs/*.jar before-deploy/
cd before-deploy && zip -r before-deploy *
cd ../ && mkdir -p deploy
mv before-deploy/before-deploy.zip deploy/reredeployfiles.zip
- name: Deploy to S3 (GitHub Artifacts)
uses: actions/upload-artifact@v4
with:
name: deploy
path: deploy
- name: AWS ์๊ฒฉ์ฆ๋ช
์ค์
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2
- name: S3์ ๋ฐฐํฌ
run: aws s3 cp deploy/reredeployfiles.zip s3://rerebucket/reredeployfiles.zip
- name: AWS CodeDeploy๋ฅผ ์ฌ์ฉํ ๋ฐฐํฌ
run: |
aws deploy create-deployment \
--application-name rere-deploy \
--deployment-group-name rere-deploy-group \
--s3-location bucket=rerebucket,key=reredeployfiles.zip,bundleType=zip \
--region ap-northeast-2