-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (109 loc) · 5.24 KB
/
wespot-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
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
116
117
118
119
120
name: Wespot-cd workflow
on:
workflow_dispatch:
pull_request:
branches:
- develop
- main
types: [ closed ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_ACCESS_TOKEN }}
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew app:build --stacktrace
- name: Docker buildx 설치
uses: docker/[email protected]
- name: Docker Hub Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Docker Image Build
run: docker buildx build --platform linux/amd64 -t wespot0817/wespot . --push
- name: Zero Down Time Deploy Start
uses: appleboy/[email protected]
with:
host: ${{ secrets.WAS_HOST }}
username: ${{ secrets.WAS_USERNAME }}
key: ${{ secrets.WAS_SSH_KEY }}
port: ${{ secrets.WAS_SSH_PORT }}
script: |
sudo sh zero-down-time.sh
- name: Send Success Message
if: ${{ success() }}
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: Server 사랑의 BOT
DISCORD_AVATAR: https://www.notion.so/image/https%3A%2F%2Fi.imgur.com%2FqIqJ0GA.png?table=block&id=232c40c1-598a-4163-bb8d-acf1151cd026&spaceId=4263d120-003b-49f8-8cb5-37585d6fb45d&width=2000&userId=c0125a99-ca81-4e9f-9c32-096f12a6698c&cache=v2
DISCORD_EMBEDS: |
[
{
"author": {
"name": "${{ github.event.pull_request.user.login }}",
"url": "https://github.com/pknu-wap/WAPP/blob/main/image/icon.png?raw=true",
"icon_url": "${{ github.event.pull_request.user.avatar_url }}"
},
"title": "배포 성공 ~ 진호 엉덩이 한번 확인해보자 ~ 🥰🥰 \n#${{ github.event.pull_request.number }} : ${{ github.event.pull_request.title }}",
"color": 10478271,
"description": "${{ github.event.pull_request.html_url }}",
"fields": [
{
"name": "Base Branch",
"value": "${{ github.base_ref }}",
"inline": true
},
{
"name": "Compare Branch",
"value": "${{ github.head_ref }}",
"inline": true
}
]
}
]
- name: Send Failure Message
if: ${{ failure() }}
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: Server 사랑의 BOT
DISCORD_AVATAR: https://www.notion.so/image/https%3A%2F%2Fi.imgur.com%2FqIqJ0GA.png?table=block&id=232c40c1-598a-4163-bb8d-acf1151cd026&spaceId=4263d120-003b-49f8-8cb5-37585d6fb45d&width=2000&userId=c0125a99-ca81-4e9f-9c32-096f12a6698c&cache=v2
DISCORD_EMBEDS: |
[
{
"author": {
"name": "${{ github.event.pull_request.user.login }}",
"url": "https://github.com/pknu-wap/WAPP/blob/main/image/icon.png?raw=true",
"icon_url": "${{ github.event.pull_request.user.avatar_url }}"
},
"title": "배포 실패... 진호짱 엉덩이 맞게 매 가져와 \n#${{ github.event.pull_request.number }} : ${{ github.event.pull_request.title }}",
"color": 13458524,
"description": "${{ github.event.pull_request.html_url }}",
"fields": [
{
"name": "Base Branch",
"value": "${{ github.base_ref }}",
"inline": true
},
{
"name": "Compare Branch",
"value": "${{ github.head_ref }}",
"inline": true
}
]
}
]