-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (63 loc) · 2.6 KB
/
prod-cd.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
name: Java Prod CD with Gradle
on:
push:
branches: [ master ]
jobs:
Prod-CD:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Create application.yml
run: |
touch ./src/main/resources/application.yml
echo "${{ secrets.APPLICATION_YML }}" >> ./src/main/resources/application.yml
- name: Create application-dev.yml
run: |
touch ./src/main/resources/application-dev.yml
echo "${{ secrets.APPLICATION_DEV_YML }}" >> ./src/main/resources/application-dev.yml
- name: Create application-prod-cd.yml
run: |
touch ./src/main/resources/application-prod.yml
echo "${{ secrets.APPLICATION_PROD_YML }}" >> ./src/main/resources/application-prod.yml
- name: Create application-test.yml
run: |
mkdir ./src/test/resources
touch ./src/test/resources/application.yml
echo "${{ secrets.APPLICATION_TEST_YML }}" >> ./src/test/resources/application.yml
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
- name: Make zip file
run: zip -qq -r ./$GITHUB_SHA.zip .
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_CODEDEPLOY_KEY }}
aws-secret-access-key: ${{ secrets.AWS_CODEDEPLOY_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://dotori-jar/jar/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name dotori-app --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name prod --s3-location bucket=dotori-jar,bundleType=zip,key=jar/$GITHUB_SHA.zip
- name: Dotori Prod Server CD Success Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ success() }}
with:
title: 🎉 Dotori Prod Server CD 🐿
webhook: ${{ secrets.DISCORD_WEBHOOK }}
color: 00FF00
- name: Dotori Prod Server CD Fail Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ failure() }}
with:
title: ❌ Dotori Prod Server CD 🐿
webhook: ${{ secrets.DISCORD_WEBHOOK }}
color: FF0000