-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (96 loc) · 3.24 KB
/
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
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
name: crews backend development version distribute
on:
push:
branches: [ "fix/workflow-slack-alarm" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTION_TOKEN }}
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Set up MySQL
uses: mirromutth/[email protected]
with:
mysql database: 'crews'
mysql user: ${{ secrets.TEST_DB_USERNAME }}
mysql password: ${{ secrets.TEST_DB_PASSWORD }}
- name: Set up Redis And Redis Stack
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./docker-compose-local.yml"
- name: Run Test And Create API Documentation
run: ./gradlew openapi3
- name: Build with Gradle
run: ./gradlew bootJar -x test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image And Push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKER_SERVER_IMAGE_NAME }}
platforms: |
linux/amd64
linux/arm64
alarm:
needs: build
runs-on: ubuntu-latest
steps:
- name: Extract PR number from commit message
id: pr_info
run: |
# Extract PR number from the commit message
PR_NUMBER=$(git log -1 --pretty=%B | grep -oP '#\d+' | sed 's/#//')
if [ -z "$PR_NUMBER" ]; then
echo "No PR number found in commit message"
exit 1
fi
# Use GitHub API to get PR details
PR_URL="https://github.com/${{ github.repository }}/pull/$PR_NUMBER"
PR_TITLE=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | jq -r .title)
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
- name: Notify Slack on Success
if: success()
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "새로운 개발 서버 버전이 배포됐어요! \n ✅ PR: <${{ env.PR_URL }}|${{ env.PR_TITLE }}>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEV }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK