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 "//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||${BLOCK}\n|" "$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