Add auto-update for index.json via Gitea Actions
This commit is contained in:
48
.gitea/workflows/update-index.yml
Normal file
48
.gitea/workflows/update-index.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Update Plugin Index
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
paths:
|
||||||
|
- 'plugins/*.json'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-index:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Generate index.json
|
||||||
|
run: |
|
||||||
|
cd plugins
|
||||||
|
echo '{' > index.json
|
||||||
|
echo ' "version": "1.0.0",' >> index.json
|
||||||
|
echo ' "updatedAt": "'$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")'",' >> index.json
|
||||||
|
echo ' "plugins": [' >> index.json
|
||||||
|
|
||||||
|
first=true
|
||||||
|
for file in *.json; do
|
||||||
|
if [ "$file" != "index.json" ]; then
|
||||||
|
plugin_id="${file%.json}"
|
||||||
|
if [ "$first" = true ]; then
|
||||||
|
echo " \"$plugin_id\"" >> index.json
|
||||||
|
first=false
|
||||||
|
else
|
||||||
|
echo " ,\"$plugin_id\"" >> index.json
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ' ]' >> index.json
|
||||||
|
echo '}' >> index.json
|
||||||
|
|
||||||
|
- name: Commit index.json
|
||||||
|
run: |
|
||||||
|
git config user.name "Gitea Actions"
|
||||||
|
git config user.email "actions@gitea.local"
|
||||||
|
git add plugins/index.json
|
||||||
|
if git diff --staged --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
else
|
||||||
|
git commit -m "Auto-update plugin index"
|
||||||
|
git push
|
||||||
|
fi
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"id": "example-plugin-2",
|
||||||
|
"name": "Example Plugin 2",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A second example plugin demonstrating additional capabilities",
|
||||||
|
"author": "litruv",
|
||||||
|
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example2.git",
|
||||||
|
"downloadUrl": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example2/archive/main.zip",
|
||||||
|
"homepage": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example2",
|
||||||
|
"tags": ["example", "demo", "filtering", "validation"],
|
||||||
|
"addedDate": "2026-04-17T00:00:00.000Z"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user