forked from cmangos/mangos-tbc
-
Notifications
You must be signed in to change notification settings - Fork 17
209 lines (185 loc) · 7.83 KB
/
windows-release.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Windows release build
#
on:
schedule:
# every day at 6am
- cron: '0 6 * * *'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir
BOOST_TOOLSET: "msvc"
BOOST_VERSION: "1.79.0"
BOOST_PLATFORM_VERSION: "2022"
jobs:
build:
runs-on: windows-2022
permissions:
contents: read
strategy:
matrix:
include:
- OPTIONAL_DEFINES: ""
TYPE: "default"
- OPTIONAL_DEFINES: "-DBUILD_ELUNA=ON -DBUILD_SOLOCRAFT=ON -DBUILD_EXTRACTORS=ON -DBUILD_PLAYERBOT=ON -DBUILD_AHBOT=ON -DBUILD_RECASTDEMOMOD=ON -DBUILD_GIT_ID=ON"
TYPE: "with-all"
- OPTIONAL_DEFINES: "-DBUILD_ELUNA=ON -DBUILD_PLAYERBOT=ON -DBUILD_AHBOT=ON"
TYPE: "with-eluna-playerbot-ahbot"
- OPTIONAL_DEFINES: "-DBUILD_ELUNA=ON -DBUILD_PLAYERBOT=ON"
TYPE: "with-eluna-playerbot"
- OPTIONAL_DEFINES: "-DBUILD_ELUNA=ON -DBUILD_AHBOT=ON"
TYPE: "with-eluna-ahbot"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{env.REPO_DIR}}
submodules: true
- uses: FranzDiebold/github-env-vars-action@v2
- name: Create Build Environment
run: |
echo "ARCHIVE_FILENAME=$env:CI_REPOSITORY_NAME-${{matrix.TYPE}}-$env:CI_SHA_SHORT.zip" >> $env:GITHUB_ENV
cmake -E make_directory ${{ env.BUILD_DIR }}
# install dependencies
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
# REQUIRED: Specify the required boost version
# A list of supported versions can be found here:
# https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json
boost_version: ${{env.BOOST_VERSION}}
# OPTIONAL: Specify a platform version
platform_version: ${{env.BOOST_PLATFORM_VERSION}}
# OPTIONAL: Specify a toolset
toolset: ${{env.BOOST_TOOLSET}}
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
- name: Configure
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
run: cmake ${{matrix.OPTIONAL_DEFINES}} -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}
- name: Build
env:
MAKEFLAGS: "-j8"
run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}}
- name: Archive files
run: |
cd ${{env.BUILD_DIR}}/bin
7z a -tzip ${{env.ARCHIVE_FILENAME}} "x64_${{env.BUILD_TYPE}}"
- name: Archive this artefact
uses: actions/upload-artifact@v3
with:
name: snapshot-${{matrix.TYPE}}
path: "${{env.BUILD_DIR}}/bin/${{env.ARCHIVE_FILENAME}}"
upload:
runs-on: windows-2022
permissions:
contents: write # for marvinpinto/action-automatic-releases to generate pre-release
needs: build
steps:
- name: Download artifact snapshot-default
uses: actions/download-artifact@v3
with:
name: snapshot-default
path: all_snapshots
- name: Download artifact snapshot-with-all
uses: actions/download-artifact@v3
with:
name: snapshot-with-all
path: all_snapshots
- name: Download artifact snapshot-with-eluna-playerbot-ahbot
uses: actions/download-artifact@v3
with:
name: snapshot-with-eluna-playerbot-ahbot
path: all_snapshots
- name: Download artifact snapshot-with-eluna-playerbot
uses: actions/download-artifact@v3
with:
name: snapshot-with-eluna-playerbot
path: all_snapshots
- name: Download artifact snapshot-with-eluna-ahbot
uses: actions/download-artifact@v3
with:
name: snapshot-with-eluna-ahbot
path: all_snapshots
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Upload snapshot
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Development Build(${{ steps.date.outputs.date }})"
files: all_snapshots
notify-success:
name: Discord release successfully notification
runs-on: ubuntu-20.04
permissions:
contents: none
needs:
- upload
steps:
- name: Set environmental variables
run: |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
shortSHA=`echo ${GITHUB_SHA} | cut -c1-8`
echo "GIT_SHORT_SHA=${shortSHA}" >> $GITHUB_ENV
projectNames="${GITHUB_REPOSITORY#*/}"
expension="${projectNames#*-}"
echo "EXPENSION_NAME=${expension}" >> $GITHUB_ENV
echo "DEFAULT_ARCH_NAME=${projectNames}-default-${shortSHA}.zip" >> $GITHUB_ENV
echo "ALL_ARCH_NAME=${projectNames}-with-all-${shortSHA}.zip" >> $GITHUB_ENV
echo "AB_ARCH_NAME=${projectNames}-with-ahbot-${shortSHA}.zip" >> $GITHUB_ENV
echo "PB_ARCH_NAME=${projectNames}-with-playerbot-${shortSHA}.zip" >> $GITHUB_ENV
echo "PB_AB_ARCH_NAME=${projectNames}-with-playerbot-ahbot-${shortSHA}.zip" >> $GITHUB_ENV
- name: Notify
uses: rjstone/[email protected]
with:
severity: info
username: ${{env.EXPENSION_NAME}}-core
description: |
**${{env.EXPENSION_NAME}} prebuilt have just been released**
details: |
**Branch:** ${{env.GIT_BRANCH}}
__**Winodws prebuild Binaries**__
- [Default download](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.DEFAULT_ARCH_NAME}})
- [All options on](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.ALL_ARCH_NAME}})
- [AhBot enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.AB_ARCH_NAME}})
- [PlayerBot enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.PB_ARCH_NAME}})
- [AhBot and PlayerBot enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.PB_AB_ARCH_NAME}})
footer: By CMaNGOS team!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_RELEASE }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png
notify:
name: Discord Notification
runs-on: ubuntu-20.04
permissions:
contents: none
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()
steps:
- name: Env
run: |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Notify
uses: rjstone/[email protected]
with:
severity: error
username: ${{env.EXPENSION_NAME}}-core
description: |
**Windows buid 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 police called!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png