From 4dcb8a29f558c736d703d1179e786b0515f41de3 Mon Sep 17 00:00:00 2001 From: Reasonix Date: Fri, 14 Aug 2026 16:24:47 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20Gitea=20Actions=20=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=8C=85=E5=8F=91=E5=B8=83=20+=20?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=8C=85=E6=94=AF=E6=8C=81=E5=8D=B8=E8=BD=BD?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .gitea/workflows/auto-release.yml:每周一 cron + 手动触发,自动检查 dsh 最新版、 打包 online 安装包、创建 Release 并上传附件(push 触发为临时验证用) - install.cmd 加入仓库:安装时注册 Windows 卸载项(配合 uninstall.vbs) --- .gitea/workflows/auto-release.yml | 64 +++++++++++++++++++++++++++++++ install.cmd | 61 +++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 .gitea/workflows/auto-release.yml create mode 100644 install.cmd diff --git a/.gitea/workflows/auto-release.yml b/.gitea/workflows/auto-release.yml new file mode 100644 index 0000000..e805c43 --- /dev/null +++ b/.gitea/workflows/auto-release.yml @@ -0,0 +1,64 @@ +name: auto-release + +on: + schedule: + - cron: '0 3 * * 1' # 每周一 03:00 UTC + workflow_dispatch: {} # 手动触发 + push: + branches: [master] # 临时:用于验证 runner,验证后移除 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: Get latest dsh version + id: version + run: | + LATEST=$(npm view @deepseek-ai/dsh version) + echo "latest=$LATEST" + echo "latest=$LATEST" >> "$GITHUB_OUTPUT" + + - name: Assemble online package + run: | + mkdir -p pkg/app/src + cp app/dsh-app.exe pkg/app/ + cp app/Microsoft.Web.WebView2.Core.dll app/Microsoft.Web.WebView2.WinForms.dll app/WebView2Loader.dll pkg/app/ + cp app/src/dsh-app.cs app/src/app.manifest pkg/app/src/ + cp dsh.ico README.md install.cmd uninstall.vbs register-uninstall.ps1 pkg/ + cd pkg && python3 - <<'PY' +import zipfile, os +with zipfile.ZipFile('../dsh-desktop-online.zip', 'w', zipfile.ZIP_DEFLATED) as z: + for r, _, fs in os.walk('.'): + for f in fs: + p = os.path.join(r, f) + z.write(p, os.path.relpath(p, '.')) +PY + + - name: Create release + id: release + run: | + VER="${{ steps.version.outputs.latest }}" + BODY="Auto-built by Gitea Actions. dsh version: ${VER}. Online install package (runs install.cmd, requires network)." + curl -s -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"v${VER}\",\"name\":\"DeepSeek Harness v${VER}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \ + "https://git.vanusys.com/api/v1/repos/${{ github.repository }}/releases" > release.json + python3 -c "import json; print(json.load(open('release.json'))['id'])" > release_id.txt + echo "release_id=$(cat release_id.txt)" >> "$GITHUB_OUTPUT" + + - name: Upload asset + run: | + ID="${{ steps.release.outputs.release_id }}" + curl -s -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -F "attachment=@dsh-desktop-online.zip" \ + "https://git.vanusys.com/api/v1/repos/${{ github.repository }}/releases/${ID}/assets" diff --git a/install.cmd b/install.cmd new file mode 100644 index 0000000..15f40ff --- /dev/null +++ b/install.cmd @@ -0,0 +1,61 @@ +@echo off +setlocal +title DeepSeek Harness Installer (Online) + +echo ============================================ +echo DeepSeek Harness Desktop - Online Install +echo ============================================ +echo. + +REM ---- 1. Node.js ---- +where node >nul 2>nul +if %errorlevel%==0 ( + echo [1/5] Node.js detected + goto node_ok +) +echo [1/5] Node.js not found, installing via winget... +winget install --id OpenJS.NodeJS.LTS -e --accept-source-agreements --accept-package-agreements +if %errorlevel% neq 0 ( + echo. + echo [ERROR] Node.js install failed. Please install manually from https://nodejs.org (LTS), then run this script again. + pause + exit /b 1 +) +set "PATH=%PATH%;C:\Program Files\nodejs;%APPDATA%\npm" +:node_ok + +REM ---- 2. npm registry (mirror for speed) ---- +echo [2/5] Setting npm mirror registry... +call npm config set registry https://registry.npmmirror.com + +REM ---- 3. Install dsh ---- +echo [3/5] Installing DeepSeek Harness (dsh)... +call npm install -g @deepseek-ai/dsh +if %errorlevel% neq 0 ( + echo. + echo [ERROR] dsh install failed. Check network and retry. + pause + exit /b 1 +) + +REM ---- 4. Deploy app ---- +echo [4/5] Deploying application... +set "DEST=%LOCALAPPDATA%\DeepSeekHarness" +if not exist "%DEST%" mkdir "%DEST%" +xcopy /E /I /Y app "%DEST%\app" >nul +copy /Y dsh.ico "%DEST%\" >nul +copy /Y README.md "%DEST%\" >nul + +REM ---- 5. Register uninstall (Apps & Features) ---- +echo [5/5] Registering uninstall entry... +copy /Y uninstall.vbs "%DEST%\" >nul +copy /Y register-uninstall.ps1 "%DEST%\" >nul +powershell -NoProfile -ExecutionPolicy Bypass -File "%DEST%\register-uninstall.ps1" + +REM ---- 6. Desktop shortcut ---- +powershell -NoProfile -ExecutionPolicy Bypass -Command "$s=(New-Object -ComObject WScript.Shell).CreateShortcut([Environment]::GetFolderPath('Desktop')+'\DeepSeek Harness.lnk');$s.TargetPath='%DEST%\app\dsh-app.exe';$s.IconLocation='%DEST%\dsh.ico,0';$s.WorkingDirectory='%DEST%\app';$s.Save()" + +echo. +echo Install complete! Launching... +start "" "%DEST%\app\dsh-app.exe" +pause