-
Notifications
You must be signed in to change notification settings - Fork 12
207 lines (186 loc) · 7.66 KB
/
main.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
name: OctoBot-Binary-CI
on:
schedule:
- cron: '0 5 * * 1' # every monday at 5am
push:
jobs:
builds:
name: ${{ matrix.os }} - ${{ matrix.arch }} - Python 3.10 - build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-22.04 ]
arch: [ x64, arm64 ]
exclude:
- os: macos-latest
arch: arm64
- os: windows-latest
arch: arm64
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
architecture: x64
- name: Build OctoBot Binary on Linux arm64
if: matrix.os == 'ubuntu-22.04' && matrix.arch == 'arm64'
uses: uraimo/[email protected]
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
env: |
GH_REPO: Drakkar-Software/OctoBot-Tentacles
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
BUILD_ARCH: ${{ matrix.arch }}
run: |
apt-get update
apt-get install -y --no-install-recommends python3.10 python3-pip python3-dev git gcc musl-dev libc-dev build-essential zlib1g zlib1g-dev
bash ./build_scripts/unix.sh
- name: Build OctoBot Binary on Linux
if: matrix.os == 'ubuntu-22.04' && matrix.arch == 'x64'
env:
GH_REPO: Drakkar-Software/OctoBot-Tentacles
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
BUILD_ARCH: ${{ matrix.arch }}
run: bash ./build_scripts/unix.sh
- name: Build OctoBot Binary on MacOS
if: matrix.os == 'macos-latest'
env:
GH_REPO: Drakkar-Software/OctoBot-Tentacles
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
BUILD_ARCH: ${{ matrix.arch }}
run: bash ./build_scripts/unix.sh
- name: Build OctoBot Binary on Windows
if: matrix.os == 'windows-latest'
env:
GH_REPO: Drakkar-Software/OctoBot-Tentacles
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
run: .\build_scripts\windows.ps1
shell: powershell
- name: Upload OctoBot Binary on MacOS
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: OctoBot_macos_${{ matrix.arch }}
path: OctoBot/OctoBot_${{ matrix.arch }}
if-no-files-found: error
- name: Upload OctoBot Binary on Linux
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-22.04'
with:
name: OctoBot_linux_${{ matrix.arch }}
path: OctoBot/OctoBot_${{ matrix.arch }}
if-no-files-found: error
- name: Upload OctoBot Binary on Windows
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: OctoBot_windows_${{ matrix.arch }}.exe
path: OctoBot/dist/OctoBot_windows.exe
if-no-files-found: error
create-release:
name: Create Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: builds
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Set version as environement var
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Clean artifact names
run: |
sudo apt-get update
sudo apt-get install rename -y
find . -type f -exec bash -c 'mv $1 $(basename $(dirname $1)).tmp && rm -rf $(basename $(dirname $1)) && rename 's/\.tmp$//' *.tmp' _ {} \;
- name: Compute hashes
id: hashes
run: |
echo ::set-output name=octobot_linux_x64_hash::$(openssl sha256 ./OctoBot_linux_x64 | awk '{print $2}')
echo ::set-output name=octobot_linux_arm64_hash::$(openssl sha256 ./OctoBot_linux_arm64 | awk '{print $2}')
echo ::set-output name=octobot_macos_x64_hash::$(openssl sha256 ./OctoBot_macos_x64 | awk '{print $2}')
echo ::set-output name=octobot_windows_x64_hash::$(openssl sha256 ./OctoBot_windows_x64.exe | awk '{print $2}')
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.tag }}
release_name: Release - ${{ steps.vars.outputs.tag }}
owner: ${{ github.repository_owner }}
repo: OctoBot
draft: true
prerelease: false
commitish: master
body: |
| Binary | Download link | SHA256 |
| ------------- |:-------------:|:-------------:|
| Windows x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_windows_x64.exe) | ${{ steps.hashes.outputs.octobot_windows_x64_hash }} |
| Linux x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_x64) | ${{ steps.hashes.outputs.octobot_linux_x64_hash }} |
| Linux arm64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_arm64) | ${{ steps.hashes.outputs.octobot_linux_arm64_hash }} |
| MacOS x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_macos_x64) | ${{ steps.hashes.outputs.octobot_macos_x64_hash }} |
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OctoBot_windows_x64.exe
asset_name: OctoBot_windows_x64.exe
asset_content_type: application/x-binary
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OctoBot_linux_x64
asset_name: OctoBot_linux_x64
asset_content_type: application/x-binary
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OctoBot_linux_arm64
asset_name: OctoBot_linux_arm64
asset_content_type: application/x-binary
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./OctoBot_macos_x64
asset_name: OctoBot_macos_x64
asset_content_type: application/x-binary
notify:
name: Notify
runs-on: ubuntu-22.04
needs:
- builds
- create-release
if: ${{ failure() }}
steps:
- name: Notify discord
uses: sarisia/actions-status-discord@v1
with:
status: Failure
webhook: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}