ci: serve the plugin repository from manifest.json on main
Build / build (push) Successful in 1m50s

The install URL is now the raw manifest in the source tree. The workflow
adds each release to it and commits it back.
This commit is contained in:
2026-11-13 22:37:04 +01:00
parent 9e38c98da2
commit 28b6244a17
5 changed files with 38 additions and 21 deletions
+21 -12
View File
@@ -69,24 +69,15 @@ jobs:
jprm plugin build . --output artifacts --version "${{ steps.version.outputs.version }}"
ls -l artifacts
# The repository manifest travels with the releases: take the one from the
# latest release, add this version, and publish it again as an asset.
# manifest.json in the source tree is the plugin repository users install from.
# Add this version to it; it is committed back once the release exists.
- name: Update repository manifest
if: steps.version.outputs.release == 'true'
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
TAG: ${{ steps.version.outputs.tag }}
run: |
api="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
mkdir -p repo
previous="$(curl -fsS -H "Authorization: token $TOKEN" "$api/releases/latest" 2>/dev/null \
| python3 -c 'import json,sys; print(next((a["browser_download_url"] for a in json.load(sys.stdin).get("assets", []) if a["name"] == "manifest.json"), ""))' 2>/dev/null || true)"
if [ -n "$previous" ] && curl -fsSL -H "Authorization: token $TOKEN" -o repo/manifest.json "$previous"; then
echo "Continuing the manifest of the latest release"
else
rm -f repo/manifest.json
jprm repo init repo
fi
cp manifest.json repo/manifest.json
zip="$(ls artifacts/*.zip)"
jprm repo add \
@@ -123,3 +114,21 @@ jobs:
-F "attachment=@$file" "$api/releases/$id/assets?name=$(basename "$file")" > /dev/null
echo "Attached $(basename "$file")"
done
- name: Commit repository manifest
if: steps.version.outputs.release == 'true'
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
TAG: ${{ steps.version.outputs.tag }}
run: |
cp artifacts/manifest.json manifest.json
if git diff --quiet -- manifest.json; then
echo "manifest.json is already up to date"
exit 0
fi
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@noreply.${GITHUB_SERVER_URL#*://}"
git add manifest.json
git commit -m "chore: add $TAG to the plugin manifest [skip ci]"
git push "${GITHUB_SERVER_URL%%://*}://x-access-token:$TOKEN@${GITHUB_SERVER_URL#*://}/$GITHUB_REPOSITORY.git" HEAD:main