-
Notifications
You must be signed in to change notification settings - Fork 97
82 lines (72 loc) · 2.87 KB
/
build-check.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
name: Build Check
on:
push:
branches:
- "*"
env:
MYSQL_BIN_NAME: "mysql-8.0.28-winx64"
MYSQL_BASE_PREBUILD_ADR: "https://dev.mysql.com/get/Downloads/MySQL-8.0/"
MYSQL_BIN_EXT: ".zip"
MYSQL_FINAL_SERVER_FOLDER: "mysql-server"
MYSQL_DEFAULT_ROOT: "cmangos"
CACHED_FOLDER: "${{github.workspace}}\\CachedFolder"
WORK_FOLDER: "${{github.workspace}}\\WorkFolder"
jobs:
build-check:
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- name: Setup Environment Variables
run: |
projectNames="${GITHUB_REPOSITORY#*/}"
expansion="${projectNames%-*}"
echo "EXPANSION_NAME=${expansion}" >> $GITHUB_ENV
echo "CORE_REPO="cmangos/mangos-${expansion} >> $GITHUB_ENV
echo "CORE_FOLDER="${{github.workspace}}/mangos-${expansion} >> $GITHUB_ENV
echo "DB_FOLDER="${{github.workspace}}/${expansion}-db >> $GITHUB_ENV
- name: Checkout DB
uses: actions/checkout@v2
with:
path: ${{env.DB_FOLDER}}
- name: Checkout CORE
uses: actions/checkout@v2
with:
repository: ${{env.CORE_REPO}}
path: ${{env.CORE_FOLDER}}
- name: Build ${{env.EXPANSION_NAME}}-db
run: |
sudo /etc/init.d/mysql start
cd ${{env.DB_FOLDER}}
./InstallFullDB.sh -InstallAll root root DeleteAll
./InstallFullDB.sh -Backup full
tar -czvf "${{github.workspace}}/${{env.EXPANSION_NAME}}-all-backups.tar.gz" -C backups --exclude=".gitignore" .
sudo /etc/init.d/mysql stop
notify-failure:
name: Send Notification to Discord on Failure
runs-on: ubuntu-20.04
permissions:
contents: none
if: failure()
steps:
- name: Set Environmental Variables
run: |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
projectNames="${GITHUB_REPOSITORY#*/}"
Send Notification to Discord on Failure="${projectNames%-*}"
echo "EXPANSION_NAME=${Send Notification to Discord on Failure}" >> $GITHUB_ENV
- name: Notify
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
description: |
**${{env.EXPANSION_NAME}}-db Build Failed**
details: |
- **Branch:** ${{env.GIT_BRANCH}}
- **Pusher:** ${{github.event.pusher.name}}
- **Author:** ${{github.event.head_commit.author.name}}
- **Commit:** [${{github.repository}}/${{env.GIT_SHORT_SHA}}](${{github.server_url}}/${{ github.repository }}/commit/${{github.sha}})
- **Build Log:** [actions/runs/${{github.run_id}}](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}})
footer: CMaNGOS Developers Notified!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}