-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (82 loc) · 3.66 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
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
name: CD
on:
push:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set yml file
uses: microsoft/variable-substitution@v1
with:
files: dodam-api/src/main/resources/application.yml
env:
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USERNAME }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}
redis.master.host: ${{ secrets.REDIS_MASTER_HOST }}
redis.master.port: ${{ secrets.REDIS_MASTER_PORT }}
redis.slaves.0.host: ${{ secrets.REDIS_SLAVE_1_HOST }}
redis.slaves.0.port: ${{ secrets.REDIS_SLAVE_1_PORT }}
redis.slaves.1.host: ${{ secrets.REDIS_SLAVE_2_HOST }}
redis.slaves.1.port: ${{ secrets.REDIS_SLAVE_2_PORT }}
app.token.generate: ${{ secrets.TOKEN_GENERATE_URL }}
app.token.verify: ${{ secrets.TOKEN_VERIFY_URL }}
app.token.refresh: ${{ secrets.TOKEN_REFRESH_URL }}
app.jwt.issuer: ${{ secrets.JWT_ISSUER }}
app.jwt.tokenServer: ${{ secrets.TOKEN_SERVER_URL }}
app.youtube.key.apiKey: ${{ secrets.YOUTUBE_KEY }}
app.youtube.url.video: ${{ secrets.YOUTUBE_VIDEO_URL }}
app.youtube.url.search: ${{ secrets.YOUTUBE_SEARCH_URL }}
app.gabia.id: ${{ secrets.GABIA_ID }}
app.gabia.apiKey: ${{ secrets.GABIA_API_KEY }}
app.gabia.refKey: ${{ secrets.GABIA_REF_KEY }}
app.gabia.tokenUrl: ${{ secrets.GABIA_TOKEN_URL }}
app.gabia.smsUrl: ${{ secrets.GABIA_SMS_URL }}
app.gabia.lmsUrl: ${{ secrets.GABIA_LMS_URL }}
app.gabia.sender: ${{ secrets.GABIA_SMS_SENDER }}
app.gabia.subject: ${{ secrets.GABIA_SMS_SUBJECT }}
app.neis.apiKey: ${{ secrets.NEIS_KEY }}
app.neis.url: ${{ secrets.NEIS_URL }}
app.codenary.url: ${{ secrets.CODENARY_URL }}
app.melon.url: ${{ secrets.MELON_URL }}
app.discord.url: ${{ secrets.DISCORD_URL }}
cloud.aws.credentials.access-key: ${{ secrets.S3_ACCESS_KEY }}
cloud.aws.credentials.secret-key: ${{ secrets.S3_SECRET_KEY }}
cloud.aws.region.static: ${{ secrets.S3_REGION }}
cloud.aws.storage.endpoint: ${{ secrets.S3_ENDPOINT }}
cloud.aws.storage.bucket: ${{ secrets.S3_BUCKET }}
- name: Build with Gradle
run: ./gradlew :dodam-api:build -x test --parallel
- name: Build Docker Image For Spring
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/dodamdodam:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/dodamdodam:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: EC2 Docker Run
uses: appleboy/[email protected]
with:
host: ${{ secrets.LINUX_HOST }}
username: ${{ secrets.LINUX_USERNAME }}
password: ${{ secrets.LINUX_PASSWORD }}
port: ${{ secrets.LINUX_SSH_PORT }}
script: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker stop dodamdodam
docker rm dodamdodam
docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/dodamdodam:latest
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/dodamdodam:latest
docker run -d -p 33333:8080 --name dodamdodam ${{ secrets.DOCKERHUB_USERNAME }}/dodamdodam:latest
docker network connect redis-net dodamdodam