v2
This commit is contained in:
48
.gitea/workflows/update-plugins-xml.yml
Normal file
48
.gitea/workflows/update-plugins-xml.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
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
|
||||
Reference in New Issue
Block a user