-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (65 loc) · 2.17 KB
/
cicd_dev.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
79
80
81
82
name: Tattour-Server-Dev CD
on:
push:
branches: [ "dev" ]
env:
S3_BUCKET_NAME: tattour-storage
jobs:
build:
name: Code deployment
runs-on: ubuntu-latest
env:
DEPLOY_ENV: dev
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: make application.properties
run: |
#mkdir ./server/src/main/resources
cd ./server/src/main/resources
touch ./application.yaml
echo "${{ secrets.TATTOUR_DEV_APPLICATION }}" >> ./application.yaml
cat ./application.yaml
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x ./server/gradlew
- name: Build with Gradle
run: |
cd ./server
./gradlew clean build -x test
- name: Make Directory
run: mkdir -p deploy
- name: Copy Jar
run: cp ./server/build/libs/*.jar ./deploy
- name: Copy appspec.yml
run: cp appspec.yml ./deploy
- name: Copy script
run: cp ./scripts/*.sh ./deploy
- name: Make zip file
run: zip -r ./tattour_server_dev.zip ./deploy
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_CODEDEPLOY_ACCESS_KEY_DEV }}
aws-secret-access-key: ${{ secrets.AWS_CODEDEPLOY_SECRET_ACCESS_KEY_DEV }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./tattour_server_dev.zip s3://tattour-storage\
# Deploy
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CODEDEPLOY_ACCESS_KEY_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CODEDEPLOY_SECRET_ACCESS_KEY_DEV }}
run:
aws deploy create-deployment
--application-name tattour-dev-codedeploy
--deployment-group-name tattour-dev-codedeploy-group
--file-exists-behavior OVERWRITE
--s3-location bucket=tattour-storage,bundleType=zip,key=tattour_server_dev.zip
--region ap-northeast-2