-
-
Notifications
You must be signed in to change notification settings - Fork 68
232 lines (186 loc) · 5.45 KB
/
nightly.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Nightly
on:
push:
branches: [ main ]
paths:
- 'src/**'
- 'scripts/**'
- '.github/workflows/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js v16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Pack base asar
run: |
npm i -g asar
sed -i -e "s/nightly/nightly-$(git rev-parse HEAD | cut -c 1-7)/" src/index.js
node scripts/strip.js
npx asar pack src app.asar
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: built-asar
path: app.asar
retention-days: 1
test-linux:
name: Test Linux
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Retrieve artifact
uses: actions/download-artifact@v2
with:
name: built-asar
path: artifact
- name: Extract artifact
run: |
cp artifact/app.asar .
- name: Download Client with OpenAsar
run: |
wget "https://discord.com/api/download/canary?platform=linux&format=tar.gz" -O discord.tar.gz
tar xf discord.tar.gz
cp app.asar DiscordCanary/resources/app.asar
- name: Check if Discord will startup
run: |
coproc { xvfb-run -e /dev/stdout ./DiscordCanary/DiscordCanary --enable-logging; }
grep -m1 "Finished discord_rpc" <&${COPROC[0]}
sleep 1
[[ $COPROC_PID ]] && kill $COPROC_PID
timeout-minutes: 3
test-win:
name: Test Windows
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js v16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Retrieve artifact
uses: actions/download-artifact@v2
with:
name: built-asar
path: artifact
- name: Extract artifact
run: |
cp artifact/app.asar .
- name: Setup Client
shell: bash
run: |
node scripts/downloadWin.js
tar xf client.tar
# Install OpenAsar build and setup environment
sed -r -i "s/const config=require\('.\/config'\);/console.log\('ABRA'\);app.quit\(\); /" app.asar
sed -r -i "s/if\(next!=cur&&!options\?\.allowObsoleteHost\)/if\(false\) /" app.asar
cp -f app.asar files/resources/app.asar
mkdir discord
cp -rf files/ discord/app-1.0.0
cd discord/app-1.0.0
mkdir modules
# - name: Upload artifact
# uses: actions/upload-artifact@v2
# with:
# name: testing
# path: app.asar
# retention-days: 1
- name: Check if Discord will startup
run: |
cd discord/app-1.0.0
./DiscordCanary.exe | grep -m1 "ABRA"
timeout-minutes: 3
shell: bash
release:
name: Release
needs:
- test-linux
- test-win
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Retrieve artifact
uses: actions/download-artifact@v2
with:
name: built-asar
path: artifact
- name: Extract artifact
run: |
cp artifact/app.asar .
- name: GitHub Release
run: |
git tag -d nightly || true
git push origin --delete nightly || true
git tag nightly
git push origin nightly
curl -L -o old.asar "https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar"
gh release delete ${{ env.VERSION }} -y || true
gh release create ${{ env.VERSION }} -t "Nightly" -n "$(bash scripts/nightlyNotes.sh)" ${{ env.FILES }}
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
VERSION: 'nightly'
FILES: app.asar
# debug-linux:
# name: Debug Linux
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Retrieve artifact
# uses: actions/download-artifact@v2
# with:
# name: built-asar
# path: artifact
# - name: Extract artifact
# run: |
# cp artifact/app.asar .
# - name: Download Client with OpenAsar
# run: |
# wget "https://discord.com/api/download/canary?platform=linux&format=tar.gz" -O discord.tar.gz
# tar xf discord.tar.gz
# cp app.asar DiscordCanary/resources/app.asar
# - name: Run Client
# run: |
# xvfb-run -e /dev/stdout ./DiscordCanary/DiscordCanary --enable-logging 2>&1
# timeout-minutes: 5
# debug-win:
# name: Debug Windows
# needs: build
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2
# - name: Setup Node.js v16.x
# uses: actions/setup-node@v2
# with:
# node-version: 16.x
# - name: Retrieve artifact
# uses: actions/download-artifact@v2
# with:
# name: built-asar
# path: artifact
# - name: Extract artifact
# run: |
# cp artifact/app.asar .
# - name: Setup Client
# shell: bash
# run: |
# node scripts/downloadWin.js
# tar xf client.tar
# # Install OpenAsar build and setup environment
# cp -f app.asar files/resources/app.asar
# mkdir discord
# cp -rf files/ discord/app-1.0.0
# cd discord/app-1.0.0
# mkdir modules
# - name: Run Client
# run: |
# cd discord/app-1.0.0
# ./DiscordCanary.exe --enable-logging
# timeout-minutes: 5
# shell: bash