CI/CD: modify workflow

This commit is contained in:
zerlei 2024-10-13 11:56:54 +08:00
parent 0952a40997
commit b2da2ffc4f
3 changed files with 11 additions and 49 deletions

View file

@ -1,8 +1,6 @@
name: buildProject
on:
push:
branches:
- "main"
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
@ -15,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use NodeJs
- name: Setup NodeJs
uses: actions/setup-node@v4
with:
node-version: 22.x
@ -25,22 +23,23 @@ jobs:
dotnet-version: 8.0.x
- name: build
run: |
mkdir release
mkdir release/LocalServer/wwwroot
mkdir release/RemoteServer
mkdir release/JsScript
cd Tool/webtool
npm install
npm run build
cd ../../Server
dotnet restore
cd LocalServer
dotnet publish --no-restore
dotnet publish -o ../../release/Localserver --no-restore
cd ../RemoteServer
dotnet publish --no-restore
dotnet publish -o ../../release/RemoteServer --no-restore
cd ../../
- name: Package
run: |
mkdir release
mv -Path "Server/LocalServer/bin/Release/net8.0/publish/*" -Destination "release/LocalServer"
mv -Path "Server/RemoteServer/bin/Release/net8.0/publish/*" -Destination "release/RemoteServer"
cp Tool/JsScript/* release/JsScript
cp Tool/JsScript/* release/JsScript/
Compress-Archive -Path "release/*" -DestinationPath "FS_win_dotnet8.zip" -Force
- name: Release
uses: softprops/action-gh-release@v2
@ -49,6 +48,6 @@ jobs:
files: |
FS_win_dotnet8.zip
LICENSE
name: Release ${{ github.ref }}
draft: true
name: ${{ github.ref }}
draft: false
prerelease: true

View file

@ -1,37 +0,0 @@
// import WebSocket from 'ws';
// const wsUrl = 'wss://toolin.cn/echo';
// const ws = new WebSocket(wsUrl);
// ws.on('open', () => {
// console.log('Connected to WebSocket server');
// ws.send("赵磊f",(err)=>{
// console.log(err)
// })
// });
// ws.on('message', (message) => {
// var str = message.toString('utf8')
// if(str.includes("赵磊f")) {
// ws.close()
// }
// console.log('Received message:',str);
// });
// ws.on('close', () => {
// console.log('Disconnected from WebSocket server');
// });
import chalk from 'chalk';
function logProgress(current, total) {
const progressPercentage = (current / total) * 100;
var str = `Progress: ${progressPercentage.toFixed(2)}%\r`
var x = chalk['red'](str);
process.stdout.write(x);
}
// Example usage:
setInterval(() => {
logProgress(Math.floor(Math.random() * 100), 100);
}, 100); // Update progress every 100 milliseconds with a random value

View file

@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --outDir ../../Server/LocalServer/wwwroot/",
"build": "vite build --outDir ../../release/LocalServer/wwwroot/",
"preview": "vite preview"
},
"dependencies": {