name: auto-release on: schedule: - cron: '0 3 * * 1' # 每周一 03:00 UTC workflow_dispatch: {} # 手动触发 jobs: build: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Get installer version id: version shell: bash run: | ISS="/c/Users/VanuSystems-Mu/dsh-setup/setup-offline.iss" if [ ! -f "$ISS" ]; then echo "::error::本机构建源缺失: $ISS(Offline 构建需要先同步 dsh-setup 到短路径)" exit 1 fi VER=$(sed -n 's/^#define MyAppVersion "\(.*\)"/\1/p' "$ISS") echo "version=$VER" echo "version=$VER" >> "$GITHUB_OUTPUT" - name: Build offline installer (host machine) shell: bash run: | cd /c/Users/VanuSystems-Mu/dsh-setup "/c/Program Files (x86)/Inno Setup 6/ISCC.exe" /Qp setup-offline.iss || exit 1 ls -la output/ cp output/DeepSeekHarness-Setup-Offline.exe "$GITHUB_WORKSPACE"/ echo "offline installer built: $(ls -la "$GITHUB_WORKSPACE/DeepSeekHarness-Setup-Offline.exe")" - name: Create or reuse release id: release shell: bash run: | VER="${{ steps.version.outputs.version }}" TAG="v${VER}" API="https://git.vanusys.com/api/v1/repos/${{ github.repository }}" curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$API/releases/tags/${TAG}" -o exist.json EXIST=$(python -c "import json; d=json.load(open('exist.json')); print(d.get('id',''))") if [ -n "$EXIST" ]; then echo "$EXIST" > release_id.txt echo "reuse existing release $EXIST" else BODY="Auto-built by Gitea Actions. Offline installer (bundled Node.js + dsh runtime). Installer version: ${VER}." curl -s -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"DeepSeek Harness ${TAG}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \ "$API/releases" > release.json python -c "import json; print(json.load(open('release.json'))['id'])" > release_id.txt fi echo "release_id=$(cat release_id.txt)" >> "$GITHUB_OUTPUT" - name: Upload asset shell: bash run: | ID="${{ steps.release.outputs.release_id }}" API="https://git.vanusys.com/api/v1/repos/${{ github.repository }}" AUTH="Authorization: token ${{ secrets.GITHUB_TOKEN }}" # remove same-name old assets first curl -s -H "$AUTH" "$API/releases/${ID}/assets" -o assets.json python -c "import json; [print(a['id']) for a in json.load(open('assets.json')) if a['name'] == 'DeepSeekHarness-Setup-Offline.exe']" > old_ids.txt while read AID; do curl -s -X DELETE -H "$AUTH" "$API/releases/${ID}/assets/${AID}" -o /dev/null echo "deleted old asset $AID" done < old_ids.txt curl -s -X POST -H "$AUTH" -F "attachment=@$GITHUB_WORKSPACE/DeepSeekHarness-Setup-Offline.exe" "$API/releases/${ID}/assets"