OpenAsar/.github/workflows/nightly.yml

232 lines
5.7 KiB
YAML
Raw Normal View History

2022-02-02 20:03:38 +00:00
name: Nightly
on:
push:
branches: [ main ]
paths:
- 'src/**'
- 'scripts/**'
2022-04-12 17:40:20 +00:00
- '.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: |
2022-02-02 20:03:38 +00:00
npm i -g asar
sed -i -e "s/oaVersion = '\(.*\)'/oaVersion = '\1-$(git rev-parse HEAD | cut -c 1-7)'/" src/index.js
2022-02-07 08:17:04 +00:00
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
2022-09-29 15:18:51 +00:00
needs: build
runs-on: ubuntu-latest
2022-09-29 15:18:51 +00:00
steps:
- uses: actions/checkout@v2
- name: Retrieve artifact
uses: actions/download-artifact@v2
with:
name: built-asar
2022-02-02 19:22:58 +00:00
path: artifact
2022-09-29 15:18:51 +00:00
2022-02-02 19:22:58 +00:00
- 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: |
2022-02-06 21:33:04 +00:00
coproc { xvfb-run -e /dev/stdout ./DiscordCanary/DiscordCanary --enable-logging; }
grep -m1 "Finished discord_rpc" <&${COPROC[0]}
2022-02-06 21:33:04 +00:00
sleep 1
[[ $COPROC_PID ]] && kill $COPROC_PID
2022-04-16 23:25:42 +00:00
timeout-minutes: 3
2022-04-12 18:11:21 +00:00
test-win:
name: Test Windows
2022-09-29 15:18:51 +00:00
2022-04-12 18:11:21 +00:00
needs: build
runs-on: windows-latest
2022-09-29 15:18:51 +00:00
2022-04-12 18:11:21 +00:00
steps:
- uses: actions/checkout@v2
2022-04-12 20:40:32 +00:00
- name: Setup Node.js v16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
2022-04-12 18:11:21 +00:00
- name: Retrieve artifact
uses: actions/download-artifact@v2
with:
name: built-asar
path: artifact
2022-04-12 20:40:32 +00:00
- name: Extract artifact
run: |
cp artifact/app.asar .
- name: Setup Client
2022-04-12 21:00:59 +00:00
shell: bash
2022-04-12 20:40:32 +00:00
run: |
2022-04-12 20:54:31 +00:00
node scripts/downloadWin.js
tar xf client.tar
2022-04-12 20:40:32 +00:00
# Install OpenAsar build and setup environment
2022-04-13 08:28:14 +00:00
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
2022-04-12 21:26:12 +00:00
cp -f app.asar files/resources/app.asar
2022-04-12 20:40:32 +00:00
mkdir discord
cp -rf files/ discord/app-1.0.0
cd discord/app-1.0.0
mkdir modules
2022-04-12 20:40:32 +00:00
2022-04-20 10:51:28 +00:00
# - name: Upload artifact
# uses: actions/upload-artifact@v2
# with:
# name: testing
# path: app.asar
# retention-days: 1
2022-04-13 08:00:12 +00:00
2022-04-12 20:40:32 +00:00
- name: Check if Discord will startup
run: |
2022-04-12 21:11:18 +00:00
cd discord/app-1.0.0
2022-04-13 08:44:47 +00:00
./DiscordCanary.exe | grep -m1 "ABRA"
2022-04-16 23:25:42 +00:00
timeout-minutes: 3
2022-04-12 21:11:18 +00:00
shell: bash
2022-04-12 18:11:21 +00:00
release:
name: Release
2022-04-12 21:33:25 +00:00
needs:
2022-04-17 17:21:53 +00:00
- 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
2022-09-29 15:18:51 +00:00
- name: Extract artifact
run: |
cp artifact/app.asar .
- name: GitHub Release
run: |
echo ${{ env.VERSION }}
git tag -d ${{ env.VERSION }} || true
git push origin --delete ${{ env.VERSION }} || true
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
gh release delete ${{ env.VERSION }} -y || true
gh release create ${{ env.VERSION }} -t "$(echo "${{ env.VERSION }}" | sed 's/.*/\u&/' | sed "s/nt/n't/")" -n "$(git rev-parse HEAD | cut -c 1-7) | $(git log -1 --pretty=%B)" "$([ "${{ env.VERSION }}" != "nightly" ] && echo "-p")" ${{ env.FILES }}
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
VERSION: $(strings app.asar | grep -oP "oaVersion='.*?-" | grep -oP "(?<=').*?(?=-)")
FILES: app.asar
2022-04-17 17:21:53 +00:00
2022-09-29 15:26:07 +00:00
# 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