gitea actions ng42
This commit is contained in:
@@ -273,3 +273,113 @@ jobs:
|
|||||||
VERSION: ${{ steps.daten.outputs.version }}
|
VERSION: ${{ steps.daten.outputs.version }}
|
||||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
TAG: ${{ steps.daten.outputs.tag }}
|
TAG: ${{ steps.daten.outputs.tag }}
|
||||||
|
|
||||||
|
- name: XML-Datei bestimmen
|
||||||
|
id: xmlfile
|
||||||
|
run: |
|
||||||
|
case "${{ steps.daten.outputs.channel }}" in
|
||||||
|
stable) FILE="plugins.xml" ;;
|
||||||
|
testing) FILE="plugins-testing.xml" ;;
|
||||||
|
unstable) FILE="plugins-unstable.xml" ;;
|
||||||
|
esac
|
||||||
|
echo "file=$FILE" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: XML-Datei initialisieren
|
||||||
|
run: |
|
||||||
|
cd repo
|
||||||
|
FILE="${{ steps.xmlfile.outputs.file }}"
|
||||||
|
if [ ! -s "$FILE" ]; then
|
||||||
|
echo "<plugins></plugins>" > "$FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Alten Plugin-Eintrag entfernen
|
||||||
|
run: |
|
||||||
|
cd repo
|
||||||
|
FILE="${{ steps.xmlfile.outputs.file }}"
|
||||||
|
ID="${{ steps.payload.outputs.id }}"
|
||||||
|
|
||||||
|
# Entfernt den kompletten Plugin-Block
|
||||||
|
sed -i "/<pyqgis_plugin[^>]*plugin_id=\"${ID//\//\\/}\"/,/<\/pyqgis_plugin>/d" "$FILE"
|
||||||
|
|
||||||
|
- name: metadata.txt einlesen
|
||||||
|
id: metadata
|
||||||
|
run: |
|
||||||
|
cd plugin
|
||||||
|
while read -r line || [ -n "$line" ]; do
|
||||||
|
key="${line%%=*}"
|
||||||
|
value="${line#*=}"
|
||||||
|
echo "$key=$value" >> $GITHUB_OUTPUT
|
||||||
|
echo "$key=$value"
|
||||||
|
done < $FILE
|
||||||
|
env:
|
||||||
|
FILE: "metadata.txt"
|
||||||
|
|
||||||
|
- name: Template anwenden und neue XML erzeugen
|
||||||
|
run: |
|
||||||
|
cd repo
|
||||||
|
|
||||||
|
FILE="${{ steps.xmlfile.outputs.file }}"
|
||||||
|
|
||||||
|
git fetch origin hidden/templates
|
||||||
|
git checkout origin/hidden/templates -- plugin.template
|
||||||
|
|
||||||
|
TEMPLATE="plugin.template"
|
||||||
|
|
||||||
|
# Template laden
|
||||||
|
ENTRY=$(cat "$TEMPLATE")
|
||||||
|
|
||||||
|
# Variablen ersetzen – vollständig synchron zu metadata.txt & Payload
|
||||||
|
ENTRY="${ENTRY//\{\{NAME\}\}/${{ steps.daten.outputs.name }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{VERSION\}\}/${{ steps.daten.outputs.version }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{DESCRIPTION\}\}/${{ steps.daten.outputs.description }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{AUTHOR\}\}/${{ steps.daten.outputs.author }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{EMAIL\}\}/${{ steps.daten.outputs.email }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{QGIS_MIN\}\}/${{ steps.daten.outputs.qgis_min }}"
|
||||||
|
ENTRY="${ENTRY//\{\{QGIS_MAX\}\}/${{ steps.payload.outputs.qgis_max }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{HOMEPAGE\}\}/${{ steps.payload.outputs.homepage }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{TRACKER\}\}/${{ steps.payload.outputs.tracker }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{REPOSITORY\}\}/${{ steps.payload.outputs.repository }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{EXPERIMENTAL\}\}/${{ steps.payload.outputs.experimental }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{DEPRECATED\}\}/${{ steps.payload.outputs.deprecated }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{QT6\}\}/${{ steps.payload.outputs.qt6 }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{ID\}\}/${{ steps.payload.outputs.id }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{URL\}\}/${{ steps.payload.outputs.url }}}"
|
||||||
|
ENTRY="${ENTRY//\{\{CHANGELOG\}\}/${{ steps.payload.outputs.changelog }}}"
|
||||||
|
|
||||||
|
# Neue Datei erzeugen
|
||||||
|
{
|
||||||
|
# Alles vor </plugins>
|
||||||
|
sed '/<\/plugins>/d' "$FILE"
|
||||||
|
|
||||||
|
# Neuen Eintrag einfügen
|
||||||
|
printf "%s\n" "$ENTRY"
|
||||||
|
|
||||||
|
# </plugins> wieder anhängen
|
||||||
|
echo "</plugins>"
|
||||||
|
} > new.xml
|
||||||
|
|
||||||
|
mv new.xml "$FILE"
|
||||||
|
rm $TEMPLATE
|
||||||
|
|
||||||
|
- name: Commit & Push
|
||||||
|
run: |
|
||||||
|
cd repo
|
||||||
|
|
||||||
|
git config user.name "Release Bot"
|
||||||
|
git config user.email "release-bot@noreply.localhost"
|
||||||
|
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commit nur, wenn Änderungen vorhanden sind
|
||||||
|
if ! git diff --cached --quiet; then
|
||||||
|
git commit -m "${{ inputs.name }} → ${{ steps.payload.outputs.version }}"
|
||||||
|
else
|
||||||
|
echo "Keine Änderungen – kein Commit notwendig."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Token in die URL einbauen
|
||||||
|
git remote set-url origin "https://${{ secrets.RELEASE_TOKEN }}:@${{ vars.RELEASE_URL }}/AG_QGIS/Repository.git"
|
||||||
|
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user