Files
dsh-desktop/.gitea/workflows/auto-release.yml
T
Workflow config file is invalid. Please check your config file: go-yaml load error in scanner (while scanning a simple key) at L70.C1-L71.C1: could not find expected ':'

80 lines
3.1 KiB
YAML

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: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
- name: Get latest dsh version
id: version
shell: bash
run: |
LATEST=$(npm view @deepseek-ai/dsh version)
echo "latest=$LATEST"
echo "latest=$LATEST" >> "$GITHUB_OUTPUT"
- name: Assemble online package
shell: bash
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 && python ../scripts/build-online.py ../dsh-desktop-online.zip
- name: Create or reuse release
id: release
shell: bash
run: |
VER="${{ steps.version.outputs.latest }}"
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. dsh version: ${VER}. Online install package (run install.cmd, requires network)."
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
for a in json.load(open('assets.json')):
if a['name'] == 'dsh-desktop-online.zip':
print(a['id'])
" > 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=@dsh-desktop-online.zip" "$API/releases/${ID}/assets"