Add update-manifest job to generate release.json after both builds

This commit is contained in:
2026-06-07 13:14:54 -04:00
parent 8f0f8db201
commit 0b7ace5dfa
+58
View File
@@ -166,3 +166,61 @@ jobs:
-H "Content-Type: application/octet-stream" \
--data-binary @"$path"
done
update-manifest:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
env:
GITEA_URL: https://code.lotusguild.org
REPO: LotusGuild/cinny-desktop
steps:
- name: Generate and upload release.json
env:
TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
BASE="$GITEA_URL/LotusGuild/cinny-desktop/releases/download/latest"
WIN_SIG=$(curl -sf "$BASE/LotusChat-x86_64-setup.nsis.zip.sig")
LINUX_SIG=$(curl -sf "$BASE/LotusChat-x86_64.AppImage.tar.gz.sig")
RELEASE=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
-H "Authorization: token $TOKEN")
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
VERSION=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['name'].split()[-1])")
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
python3 -c "
import json, sys
manifest = {
'version': '$VERSION',
'notes': 'Latest Lotus Chat release',
'pub_date': '$DATE',
'platforms': {
'windows-x86_64': {
'url': '$BASE/LotusChat-x86_64-setup.nsis.zip',
'signature': '''$WIN_SIG'''
},
'linux-x86_64': {
'url': '$BASE/LotusChat-x86_64.AppImage.tar.gz',
'signature': '''$LINUX_SIG'''
}
}
}
print(json.dumps(manifest, indent=2))
" > release.json
cat release.json
# Delete old manifest asset if present
OLD=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets" \
-H "Authorization: token $TOKEN" \
| python3 -c "import sys,json; print(next((str(a['id']) for a in json.load(sys.stdin) if a['name']=='release.json'), ''))" 2>/dev/null || true)
[ -n "$OLD" ] && curl -sf -X DELETE \
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets/$OLD" \
-H "Authorization: token $TOKEN" || true
curl -sf -X POST \
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=release.json" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
--data-binary @release.json