3
0
Files
Repository/.gitea/workflows/update-plugins-xml.yml
Michael Otto b8c70bf2e1 v2
2026-03-02 14:10:08 +01:00

48 lines
1.7 KiB
YAML

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
token: ${{ secrets.GITEA_TOKEN }}
- name: Select target XML file
id: target
run: |
case "${{ github.event.client_payload.channel }}" in
stable) echo "file=plugins.xml" >> $GITHUB_OUTPUT ;;
beta) echo "file=plugins-beta.xml" >> $GITHUB_OUTPUT ;;
dev) echo "file=plugins-dev.xml" >> $GITHUB_OUTPUT ;;
esac
- name: Remove existing entry for this plugin
run: |
PLUGIN="${{ github.event.client_payload.plugin }}"
FILE="${{ steps.target.outputs.file }}"
sed -i "/<pyqgis_plugin name=\"${PLUGIN}\"/,/<\/pyqgis_plugin>/d" "$FILE"
- name: Insert new XML block
run: |
FILE="${{ steps.target.outputs.file }}"
BLOCK=$(printf '${{ github.event.client_payload.xml_block }}' | sed 's/\\n/\n/g')
sed -i "s|</plugins>|${BLOCK}\n</plugins>|" "$FILE"
- 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 "[${{ github.event.client_payload.channel }}] ${{ github.event.client_payload.plugin }}" \
|| echo "Keine Änderungen"
git push origin feature/release