ci: release 已存在时复用(避免同名创建失败)
This commit is contained in:
1 parent
5d41af033f
commit
fd41de3bc5
1 file changed
+12
-3
@@ -35,18 +35,27 @@ jobs:
|
|||||||
cp dsh.ico README.md install.cmd uninstall.vbs register-uninstall.ps1 pkg/
|
cp dsh.ico README.md install.cmd uninstall.vbs register-uninstall.ps1 pkg/
|
||||||
cd pkg && python ../scripts/build-online.py ../dsh-desktop-online.zip
|
cd pkg && python ../scripts/build-online.py ../dsh-desktop-online.zip
|
||||||
|
|
||||||
- name: Create release
|
- name: Create or reuse release
|
||||||
id: release
|
id: release
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
VER="${{ steps.version.outputs.latest }}"
|
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)."
|
BODY="Auto-built by Gitea Actions. dsh version: ${VER}. Online install package (run install.cmd, requires network)."
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"v${VER}\",\"name\":\"DeepSeek Harness v${VER}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"DeepSeek Harness ${TAG}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
"https://git.vanusys.com/api/v1/repos/${{ github.repository }}/releases" > release.json
|
"$API/releases" > release.json
|
||||||
python -c "import json; print(json.load(open('release.json'))['id'])" > release_id.txt
|
python -c "import json; print(json.load(open('release.json'))['id'])" > release_id.txt
|
||||||
|
fi
|
||||||
echo "release_id=$(cat release_id.txt)" >> "$GITHUB_OUTPUT"
|
echo "release_id=$(cat release_id.txt)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Upload asset
|
- name: Upload asset
|
||||||
|
|||||||
Reference in new issue
Block a user