Erste von claude.ai erstellte Version
This commit is contained in:
3
plugins-beta.xml
Normal file
3
plugins-beta.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<plugins>
|
||||||
|
</plugins>
|
||||||
3
plugins-dev.xml
Normal file
3
plugins-dev.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<plugins>
|
||||||
|
</plugins>
|
||||||
82
plugins.xml
82
plugins.xml
@@ -1,83 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<plugins>
|
<plugins>
|
||||||
<pyqgis_plugin name="LNO Sachsen | Basisfunktionen" version="25.11.4" plugin_id="sn_basis">
|
|
||||||
<version>25.11.4</version>
|
|
||||||
<description>QGIS Plugin mit Basisfunktionen LNO Sachsen</description>
|
|
||||||
<about>Weitere Informationen über das Plugin</about>
|
|
||||||
<author>Max Mustermann</author>
|
|
||||||
<homepage>https://example.com/mein_plugin</homepage>
|
|
||||||
<download_url>https://entwicklung.vln-sn.de/AG_QGIS/Plugin_SN_Basis/releases/download/25.11.4/sn_basis.zip</download_url>
|
|
||||||
<tags>Geometrie, Analyse</tags>
|
|
||||||
<category>Analysis</category>
|
|
||||||
<icon>https://example.com/repo/mein_plugin/icon.png</icon>
|
|
||||||
<experimental>true</experimental>
|
|
||||||
<deprecated>false</deprecated>
|
|
||||||
<qgis_minimum_version>3.22</qgis_minimum_version>
|
|
||||||
<qgis_maximum_version>4.99</qgis_maximum_version>
|
|
||||||
<tracker>https://example.com/issues</tracker>
|
|
||||||
<repository>https://example.com/repo</repository>
|
|
||||||
<changelog>Initiale Version</changelog>
|
|
||||||
<created_date>2025-11-17</created_date>
|
|
||||||
<update_date>2025-11-18</update_date>
|
|
||||||
</pyqgis_plugin>
|
|
||||||
<pyqgis_plugin name="LNO Sachsen | Plan41" version="25.11.3" plugin_id="sn_plan41">
|
|
||||||
<version>25.11.3</version>
|
|
||||||
<description>QGIS Plugin mit Funktionen für Plan</description>
|
|
||||||
<about>Weitere Informationen über das Plugin</about>
|
|
||||||
<author>Max Mustermann</author>
|
|
||||||
<homepage>https://example.com/mein_plugin</homepage>
|
|
||||||
<download_url>https://entwicklung.vln-sn.de/AG_QGIS/Plugin_SN_Plan41/releases/download/25.11.3/sn_plan41.zip</download_url>
|
|
||||||
<tags>Geometrie, Analyse</tags>
|
|
||||||
<category>Analysis</category>
|
|
||||||
<icon>https://example.com/repo/mein_plugin/icon.png</icon>
|
|
||||||
<experimental>true</experimental>
|
|
||||||
<deprecated>false</deprecated>
|
|
||||||
<qgis_minimum_version>3.22</qgis_minimum_version>
|
|
||||||
<qgis_maximum_version>4.99</qgis_maximum_version>
|
|
||||||
<tracker>https://example.com/issues</tracker>
|
|
||||||
<repository>https://example.com/repo</repository>
|
|
||||||
<changelog>Initiale Version</changelog>
|
|
||||||
<created_date>2025-11-17</created_date>
|
|
||||||
<update_date>2025-11-17</update_date>
|
|
||||||
</pyqgis_plugin>
|
|
||||||
<pyqgis_plugin name="LNO Sachsen | Verfahrensgebiet" version="25.11.4" plugin_id="sn_verfahrensgebiet">
|
|
||||||
<version>25.11.4</version>
|
|
||||||
<description>QGIS Plugin mit Funktionen für das Verfahrensgebiet</description>
|
|
||||||
<about>Weitere Informationen über das Plugin</about>
|
|
||||||
<author>Max Mustermann</author>
|
|
||||||
<homepage>https://example.com/mein_plugin</homepage>
|
|
||||||
<download_url>https://entwicklung.vln-sn.de/AG_QGIS/Plugin_SN_Verfahrensgebiet/releases/download/25.11.4/sn_verfahrensgebiet.zip</download_url>
|
|
||||||
<tags>Geometrie, Analyse</tags>
|
|
||||||
<category>Analysis</category>
|
|
||||||
<icon>https://example.com/repo/mein_plugin/icon.png</icon>
|
|
||||||
<experimental>true</experimental>
|
|
||||||
<deprecated>false</deprecated>
|
|
||||||
<qgis_minimum_version>3.22</qgis_minimum_version>
|
|
||||||
<qgis_maximum_version>4.99</qgis_maximum_version>
|
|
||||||
<tracker>https://example.com/issues</tracker>
|
|
||||||
<repository>https://example.com/repo</repository>
|
|
||||||
<changelog>Initiale Version</changelog>
|
|
||||||
<created_date>2025-11-17</created_date>
|
|
||||||
<update_date>2025-11-18</update_date>
|
|
||||||
</pyqgis_plugin>
|
|
||||||
<pyqgis_plugin name="LNO Sachsen | Widmung" version="25.11.3" plugin_id="sn_widmung">
|
|
||||||
<version>25.11.3</version>
|
|
||||||
<description>QGIS Plugin mit Funktionen zum Erstellen von Widmungskarten</description>
|
|
||||||
<about>Weitere Informationen über das Plugin</about>
|
|
||||||
<author>Max Mustermann</author>
|
|
||||||
<homepage>https://example.com/mein_plugin</homepage>
|
|
||||||
<download_url>https://entwicklung.vln-sn.de/AG_QGIS/Plugin_SN_Widmung/releases/download/25.11.3/sn_widmung.zip</download_url>
|
|
||||||
<tags>Geometrie, Analyse</tags>
|
|
||||||
<category>Analysis</category>
|
|
||||||
<icon>https://example.com/repo/mein_plugin/icon.png</icon>
|
|
||||||
<experimental>true</experimental>
|
|
||||||
<deprecated>false</deprecated>
|
|
||||||
<qgis_minimum_version>3.22</qgis_minimum_version>
|
|
||||||
<qgis_maximum_version>4.99</qgis_maximum_version>
|
|
||||||
<tracker>https://example.com/issues</tracker>
|
|
||||||
<repository>https://example.com/repo</repository>
|
|
||||||
<changelog>Initiale Version</changelog>
|
|
||||||
<created_date>2025-11-17</created_date>
|
|
||||||
<update_date>2025-11-17</update_date>
|
|
||||||
</pyqgis_plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
46
scripts/.gitea/workflows/update-plugins-xml.yml
Normal file
46
scripts/.gitea/workflows/update-plugins-xml.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: Update plugins.xml
|
||||||
|
|
||||||
|
on:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [plugin-released]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
runs-on: alpine-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: feature/release # Während Testphase auf feature/release arbeiten
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: apk add --no-cache python3 py3-lxml py3-requests
|
||||||
|
|
||||||
|
- name: Update plugins.xml
|
||||||
|
env:
|
||||||
|
GITEA_URL: ${{ vars.GITEA_URL }}
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
PLUGIN_NAME: ${{ github.event.client_payload.plugin }}
|
||||||
|
VERSION: ${{ github.event.client_payload.version }}
|
||||||
|
CHANNEL: ${{ github.event.client_payload.channel }}
|
||||||
|
DOWNLOAD_URL: ${{ github.event.client_payload.download_url }}
|
||||||
|
run: |
|
||||||
|
python3 scripts/update_plugins_xml.py \
|
||||||
|
--plugin "$PLUGIN_NAME" \
|
||||||
|
--version "$VERSION" \
|
||||||
|
--channel "$CHANNEL" \
|
||||||
|
--download-url "$DOWNLOAD_URL"
|
||||||
|
|
||||||
|
- name: Commit and push
|
||||||
|
env:
|
||||||
|
GITEA_URL: ${{ vars.GITEA_URL }}
|
||||||
|
run: |
|
||||||
|
git config user.name "Gitea Actions"
|
||||||
|
git config user.email "actions@gitea.local"
|
||||||
|
git remote set-url origin \
|
||||||
|
https://oauth2:${{ secrets.GITEA_TOKEN }}@${GITEA_URL#https://}/${{ github.repository }}.git
|
||||||
|
git add plugins.xml plugins-beta.xml plugins-dev.xml
|
||||||
|
git commit -m "chore: [${{ github.event.client_payload.channel }}] \
|
||||||
|
${{ github.event.client_payload.plugin }} \
|
||||||
|
${{ github.event.client_payload.version }}" || echo "No changes to commit"
|
||||||
|
git push origin feature/release
|
||||||
107
scripts/update_plugins_xml.py
Normal file
107
scripts/update_plugins_xml.py
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Aktualisiert die passende plugins.xml anhand des Channels."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import zipfile
|
||||||
|
import io
|
||||||
|
import configparser
|
||||||
|
import requests
|
||||||
|
from lxml import etree
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
CHANNEL_FILES = {
|
||||||
|
"stable": "plugins.xml",
|
||||||
|
"beta": "plugins-beta.xml",
|
||||||
|
"dev": "plugins-dev.xml",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_metadata_from_zip(download_url: str, token: str) -> dict:
|
||||||
|
"""Lädt die ZIP und extrahiert metadata.txt."""
|
||||||
|
headers = {"Authorization": f"token {token}"}
|
||||||
|
print(f"→ Lade ZIP von {download_url}")
|
||||||
|
response = requests.get(download_url, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
with zipfile.ZipFile(io.BytesIO(response.content)) as z:
|
||||||
|
meta_path = next(
|
||||||
|
(n for n in z.namelist() if n.endswith("metadata.txt")), None
|
||||||
|
)
|
||||||
|
if not meta_path:
|
||||||
|
print("FEHLER: metadata.txt nicht in ZIP gefunden!", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
meta_content = z.read(meta_path).decode("utf-8")
|
||||||
|
|
||||||
|
return parse_metadata(meta_content)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_metadata(content: str) -> dict:
|
||||||
|
cfg = configparser.ConfigParser()
|
||||||
|
cfg.read_string("[plugin]\n" + content)
|
||||||
|
p = cfg["plugin"]
|
||||||
|
return {
|
||||||
|
"name": p.get("name", ""),
|
||||||
|
"qgisMinimumVersion": p.get("qgisminimumversion", "3.0"),
|
||||||
|
"qgisMaximumVersion": p.get("qgismaximumversion", "3.99"),
|
||||||
|
"description": p.get("description", ""),
|
||||||
|
"version": p.get("version", ""),
|
||||||
|
"author": p.get("author", ""),
|
||||||
|
"email": p.get("email", ""),
|
||||||
|
"homepage": p.get("homepage", ""),
|
||||||
|
"tracker": p.get("tracker", ""),
|
||||||
|
"repository": p.get("repository", ""),
|
||||||
|
"experimental": p.get("experimental", "False"),
|
||||||
|
"deprecated": p.get("deprecated", "False"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def update_xml(xml_file: str, metadata: dict, download_url: str):
|
||||||
|
xml_path = Path(xml_file)
|
||||||
|
|
||||||
|
if xml_path.exists():
|
||||||
|
tree = etree.parse(xml_path)
|
||||||
|
root = tree.getroot()
|
||||||
|
else:
|
||||||
|
root = etree.Element("plugins")
|
||||||
|
tree = etree.ElementTree(root)
|
||||||
|
|
||||||
|
# Bestehenden Eintrag gleichen Namens entfernen
|
||||||
|
plugin_name = metadata["name"]
|
||||||
|
for old in root.findall(f"pyqgis_plugin[@name='{plugin_name}']"):
|
||||||
|
root.remove(old)
|
||||||
|
|
||||||
|
# Neuen Eintrag anlegen
|
||||||
|
el = etree.SubElement(root, "pyqgis_plugin",
|
||||||
|
name=plugin_name,
|
||||||
|
version=metadata["version"])
|
||||||
|
|
||||||
|
field_order = [
|
||||||
|
"qgisMinimumVersion", "qgisMaximumVersion", "description",
|
||||||
|
"author", "email", "homepage", "tracker", "repository",
|
||||||
|
"download_url", "experimental", "deprecated",
|
||||||
|
]
|
||||||
|
for key in field_order:
|
||||||
|
child = etree.SubElement(el, key)
|
||||||
|
child.text = metadata.get(key, "") if key != "download_url" else download_url
|
||||||
|
|
||||||
|
etree.indent(tree, space=" ")
|
||||||
|
tree.write(xml_path, xml_declaration=True,
|
||||||
|
encoding="UTF-8", pretty_print=True)
|
||||||
|
print(f"✓ {xml_file} aktualisiert: {plugin_name} {metadata['version']}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--plugin", required=True)
|
||||||
|
parser.add_argument("--version", required=True)
|
||||||
|
parser.add_argument("--channel", required=True, choices=["stable", "beta", "dev"])
|
||||||
|
parser.add_argument("--download-url", required=True)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
token = os.environ.get("GITEA_TOKEN", "")
|
||||||
|
|
||||||
|
metadata = fetch_metadata_from_zip(args.download_url, token)
|
||||||
|
xml_file = CHANNEL_FILES[args.channel]
|
||||||
|
update_xml(xml_file, metadata, args.download_url)
|
||||||
Reference in New Issue
Block a user