-
Notifications
You must be signed in to change notification settings - Fork 236
153 lines (129 loc) · 4.44 KB
/
mail.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
name: build, test, publish
on:
push:
branches:
- development
- feature/*
workflow_dispatch:
inputs:
plugin:
description: What plugin to build. Omit for all.
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: compile plugins
runs-on: ubuntu-latest
steps:
- name: clean working directory
run: rm -rf /home/runner/work/${{ github.repository }}
- name: checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: retrieve latest bdbuilder version
run: |
echo '//npm.pkg.github.com/:_authToken=${{ secrets.GH_NPM_TOKEN }}' >> .npmrc
npm i @kyza/bdbuilder@latest
- name: setup nodejs
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: detect changed files
id: files
uses: jitterbit/get-changed-files@v1
continue-on-error: true # needed for force-push support
- name: build plugins
run: >-
.github/workflows/run-bdbuilder
"--trigger=${{ github.event_name }}"
"--plugin=${{ github.event.inputs.plugin }}"
${{ steps.files.outputs.all }} BetterBannedUsers
- name: stage build
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: .
retention-days: 1
test:
name: test plugins (on *stable* discord)
runs-on: ubuntu-latest
needs: build
steps:
- name: checkout code
uses: actions/checkout@v2
- name: setup nodejs
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: npm i
run: |
echo '//npm.pkg.github.com/:_authToken=${{ secrets.GH_NPM_TOKEN }}' >> .npmrc
npm i
- name: install discord
run: >-
curl --fail -L "https://discord.com/api/download?platform=linux&format=tar.gz"
| sudo tar -xz --directory /opt
&& sudo ln -sf /opt/Discord/Discord /usr/bin/Discord
- name: download discord_desktop_core
run: npm exec -- xvfb-maybe /usr/bin/Discord 2>&1 | tee module-download.log
timeout-minutes: 1
continue-on-error: true
env:
ELECTRON_ENABLE_LOGGING: true
ELECTRON_ENABLE_STACK_DUMPING: true
ELECTRON_LOG_ASAR_READS: true
- name: install BetterDiscord
run: |
DISCORD_HOST=$(grep -m 1 ^Discord module-download.log | cut -d ' ' -f 2)
sudo killall -wv -9 Discord
echo 'require("/home/runner/.config/BetterDiscord/data/betterdiscord.asar");module.exports=require("./core.asar");' \
> '/home/runner/.config/discord/'"$DISCORD_HOST"'/modules/discord_desktop_core/index.js'
echo '✅ Injection successful'
mkdir -p /home/runner/.config/BetterDiscord/data/stable/
.github/workflows/download-bd /home/runner/.config/BetterDiscord/data/betterdiscord.asar
echo '{ "general": { "download": false } }' > /home/runner/.config/BetterDiscord/data/stable/emotes.json
echo '✅ Emotes download disabled'
- name: run discord
run: npm exec -- xvfb-maybe /usr/bin/Discord 2>&1 | tee discord.log
timeout-minutes: 3
env:
ELECTRON_ENABLE_LOGGING: true
ELECTRON_ENABLE_STACK_DUMPING: true
ELECTRON_LOG_ASAR_READS: true
- name: uninstall discord
if: ${{ always() }}
run: |
sudo killall -wv -9 Discord
rm -rf /home/runner/.config/discord
sudo rm -rf /opt/Discord
sudo rm /usr/bin/Discord
publish:
name: publish plugins
runs-on: ubuntu-latest
needs: test
if: ${{ 'refs/heads/development' == github.ref }}
steps:
- name: restore repo
uses: actions/checkout@v2
with:
ref: master
- name: apply build
uses: actions/download-artifact@v2
with:
name: build-artifact
path: .
- name: commit
run: |
git config advice.addIgnoredFile false
git add --no-all ./**
git config --local user.email "[email protected]"
git config --local user.name "PluginBuilder"
git commit -m "publish build" || true
- name: push
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: master # *release* branch