fix release sync

This commit is contained in:
2026-08-12 19:45:38 +08:00
parent 9add069879
commit 9e2b7a897a

View File

@@ -145,16 +145,22 @@ jobs:
notes=$(jq -r '.body // ""' release.json)
payload=$(jq -n --arg tag "$TAG" --arg title "$title" --arg notes "$notes" \
'{tag:$tag,title:$title,release_notes:$notes,publish:true}')
# Force update release + attach all assets
curl -fsSL -X POST -H "Authorization: Bearer $SOURCECRAFT_PAT" \
-H 'Content-Type: application/json' --data "$payload" \
"https://api.sourcecraft.tech/repos/${SOURCECRAFT_ORG}/${SOURCECRAFT_REPO}/releases" || \
echo 'SourceCraft release already exists; continuing with assets.'
curl -fsSL -X PUT -H "Authorization: Bearer $SOURCECRAFT_PAT" \
-H 'Content-Type: application/json' --data "$payload" \
"https://api.sourcecraft.tech/repos/${SOURCECRAFT_ORG}/${SOURCECRAFT_REPO}/releases/${TAG}"
for file in assets/*; do
[ -f "$file" ] || continue
curl -fsSL -X POST -H "Authorization: Bearer $SOURCECRAFT_PAT" \
-F "name=$(basename "$file")" -F "file=@$file" \
"https://api.sourcecraft.tech/repos/${SOURCECRAFT_ORG}/${SOURCECRAFT_REPO}/releases/tag/${TAG}/attachments" || true
done
echo "sourcecraft=ok" >> "$GITHUB_OUTPUT"
- name: Sync release to GitLab