chore: Auto build when release

This commit is contained in:
KagurazakaNyaa 2024-09-29 18:39:49 +08:00
parent 67ca5e00bb
commit e705fc5f4e
5 changed files with 76 additions and 0 deletions

57
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: Release Build
on:
release:
types: [released]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: |
chmod a+x ./install-dependents.sh
chmod a+x ./build.sh
./install-dependents.sh
./build.sh
- name: Add binaries to production files
run: wget --input-file=lib-urls.txt --directory-prefix=production-code/daemon/lib/
- name: Create linux and windows build
run: |
cp -r production-code dist_linux
mv production-code dist_windows
- name: Copy startup scripts
run: |
cp prod-scripts/linux/* dist_linux/
cp prod-scripts/windows/* dist_windows/
- name: Copy node runtime to windows build
run: |
wget https://nodejs.org/download/release/latest-v20.x/win-x64/node.exe -O dist_windows/daemon/node_app.exe
cp dist_windows/daemon/node_app.exe dist_windows/web/node_app.exe
- name: Create archive
run: |
mv dist_linux/ mcsmanager/
tar czf mcsmanager_linux_release.tar.gz mcsmanager/
rm -rf mcsmanager/
mv dist_windows/ mcsmanager/
zip -r mcsmanager_windows_release.zip mcsmanager/
- name: Upload assets to release
uses: softprops/action-gh-release@v2
with:
files: |
mcsmanager_windows_release.zip
mcsmanager_linux_release.tar.gz

6
lib-urls.txt Normal file
View File

@ -0,0 +1,6 @@
https://github.com/MCSManager/Zip-Tools/releases/download/latest/file_zip_linux_arm64
https://github.com/MCSManager/Zip-Tools/releases/download/latest/file_zip_linux_x64
https://github.com/MCSManager/Zip-Tools/releases/download/latest/file_zip_win32_x64.exe
https://github.com/MCSManager/PTY/releases/download/latest/pty_linux_arm64
https://github.com/MCSManager/PTY/releases/download/latest/pty_linux_x64
https://github.com/MCSManager/PTY/releases/download/latest/pty_win32_x64.exe

View File

@ -0,0 +1,4 @@
#!/bin/bash
cd daemon || exit
node --max-old-space-size=8192 --enable-source-maps app.js

View File

@ -0,0 +1,4 @@
#!/bin/bash
cd web || exit
node --max-old-space-size=8192 --enable-source-maps app.js

View File

@ -0,0 +1,5 @@
cd daemon
start node_app.exe --enable-source-maps --max-old-space-size=8192 app.js
ping localhost
cd ../web
start node_app.exe --enable-source-maps --max-old-space-size=8192 app.js --open