147 lines
3.7 KiB
YAML
147 lines
3.7 KiB
YAML
name: Nightly
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'src/**'
|
|
- 'scripts/**'
|
|
- 'poly/**'
|
|
- '.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
|
|
bash scripts/injectPolyfills.sh
|
|
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 "Installing 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
|
|
run: |
|
|
# Download latest client from updater v2 and extract (manifest -> brotli -> tar)
|
|
wget "$(curl https://discord.com/api/updates/distributions/app/manifests/latest\?channel\=canary\&platform\=win\&arch\=x86 | python -c 'import json,sys;print(json.load(sys.stdin)["full"]["url"])')"
|
|
node -e "fs.writeFileSync('full.tar', zlib.brotliDecompressSync(fs.readFileSync('full.distro')))"
|
|
tar xf full.tar
|
|
|
|
# Install OpenAsar build and setup environment
|
|
sed -i "s/^\/\/ <TEST_FLAG_WINDOWS>.*$/if \(name == 'discord_rpc'\) { console.log\('ABRA'\); process.exit\(\); }/" 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
|
|
|
|
- name: Check if Discord will startup
|
|
run: |
|
|
./DiscordCanary.exe | grep -m1 "ABRA"
|
|
timeout-minutes: 3
|
|
|
|
|
|
release:
|
|
name: Release
|
|
needs: test-linux
|
|
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
|
|
gh release delete ${{ env.VERSION }} -y || true
|
|
gh release create ${{ env.VERSION }} -t "Nightly" -n "$(git rev-parse HEAD | cut -c 1-7) | $(git log -1 --pretty=%B)" ${{ env.FILES }}
|
|
env:
|
|
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
|
VERSION: 'nightly'
|
|
FILES: app.asar
|