-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (114 loc) · 3.2 KB
/
Copy pathgradle.yml
File metadata and controls
115 lines (114 loc) · 3.2 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Java CI with Gradle
on:
push:
branches: ["develop", "main"]
pull_request:
branches: ["develop", "main"]
jobs:
build:
runs-on: ubuntu-latest
services:
redis:
image: redis
steps:
- 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: |
cd ./src/main/resources
touch ./application.yml
echo "$APPLICATION" >> ./application.yml
touch ./slack.properties
echo "$SLACK" >> ./slack.properties
shell: bash
env:
APPLICATION: ${{secrets.APPLICATION}}
SLACK: ${{secrets.SLACK}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --exclude-task test
test:
needs: build
runs-on: ubuntu-latest
services:
redis:
image: redis
steps:
- 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: |
cd ./src/main/resources
touch ./application.yml
echo "$APPLICATION" >> ./application.yml
touch ./slack.properties
echo "$SLACK" >> ./slack.properties
shell: bash
env:
APPLICATION: ${{secrets.APPLICATION}}
SLACK: ${{secrets.SLACK}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test with Gradle
run: ./gradlew test
package:
needs: test
runs-on: ubuntu-latest
steps:
- 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: |
cd ./src/main/resources
touch ./application.yml
touch ./slack.properties
echo "$APPLICATION" >> ./application.yml
echo "$SLACK" >> ./slack.properties
ls -al
shell: bash
env:
APPLICATION: ${{secrets.APPLICATION}}
SLACK: ${{secrets.SLACK}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --exclude-task test
- name: Make docker image
run: |
docker build -t spring ./
docker save -o spring.tar spring
shell: bash
- name: Send Docker File
uses: appleboy/scp-action@master
with:
username: ec2-user
host: ${{secrets.DEPLOY_URL}}
key: ${{secrets.DEPLOY_KEY}}
source: "spring.tar"
target: "/home/ec2-user/deploy"
deploy:
needs: package
runs-on: ubuntu-latest
steps:
- name: Deploy Service
uses: appleboy/ssh-action@master
with:
username: ec2-user
host: ${{secrets.DEPLOY_URL}}
key: ${{secrets.DEPLOY_KEY}}
script: |
cd ./deploy
./deploy_nginx.sh