Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed May 10, 2021
1 parent 7c79c02 commit dd64ef8
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 39 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:

- package-ecosystem: pip
directory: "/requirements"
schedule:
interval: monthly
time: "04:00"
timezone: Europe/Paris

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
28 changes: 6 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- master

env:
# PROJECT_FOLDER: "qgis_plugin_repo"
PYTHON_VERSION: 3.8

jobs:
Expand Down Expand Up @@ -80,24 +79,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: "dist/*.tar.gz"
# tag_name: ${{ github.ref }}
# release_name: ${{ github.ref }}
# body_path: release.md

# - name: Deploy to PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}

#
# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./my-artifact.zip
# asset_name: my-artifact.zip
# asset_content_type: application/zip

- name: Deploy to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
96 changes: 94 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,99 @@
# QGIS-Plugin-Repo-Merge
# QGIS-Plugin-Repo

[![PyPi version badge](https://badgen.net/pypi/v/qgis-plugin-repo)](https://pypi.org/project/qgis-plugin-repo/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/qgis-plugin-repo)](https://pypi.org/project/qgis-plugin-repo/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qgis-plugin-repo)](https://pypi.org/project/qgis-plugin-repo/)

## Presentation

Merge some QGIS plugin repository together

```bash
qgis-plugin-repo-merge all_plugins.xml https://path/to/plugins_to_add.xml
qgis-plugin-repo merge output_qgis_plugin_ci.xml all_plugins.xml
qgis-plugin-repo merge https://path/to/plugins_to_add.xml all_plugins.xml
```

The file `all_plugins.xml` will be edited, according to the plugin name, plugin
version and its experimental flag or not. In an XML file, the plugin can have
two versions : one experimental and the other one not.

Additionally, you can read an XML file :
```bash
qgis-plugin-repo read https://plugins.qgis.org/plugins/plugins.xml?qgis=3.10
```

## GitHub Actions

The main puprose of this tool is to run on CI.

In the plugin repository, after [QGIS-Plugin-CI](https://github.com/opengisch/qgis-plugin-ci) :
```yml
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.TOKEN }}
repository: organisation/repository
event-type: merge-plugins
client-payload: '{"name": "NAME_OF_PLUGIN", "version": "${{ env.RELEASE_VERSION }}", "url": "URL_OF_LATEST.xml"}'
```
In the main repository with a `docs/plugins.xml` to edit :
```yaml
name: 🔀 Plugin repository
on:
repository_dispatch:
types: [merge-plugins]
jobs:
merge:
runs-on: ubuntu-latest
steps:
- run: >
echo ${{ github.event.client_payload.name }}
echo ${{ github.event.client_payload.version }}
echo ${{ github.event.client_payload.url }}
- name: Get source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2.2.1
with:
python-version: 3.8
- name: Install qgis-plugin-repo
run: pip3 install qgis-plugin-repo
- name: Merge
run: qgis-plugin-repo merge ${{ github.event.client_payload.url }} docs/plugins.xml
- name: Git identity
run: |
git config --global user.email "${{ secrets.BOT_MAIL }}"
git config --global user.name "${{ secrets.BOT_NAME }}"
- name: Check for changes
run: |
if git diff --exit-code; then
echo "changes_exist=false" >> $GITHUB_ENV
else
echo "changes_exist=true" >> $GITHUB_ENV
fi
- name: Commit and push
if: env.changes_exist == 'true'
run: |
git add -u
git commit -m "Publish QGIS Plugin ${{ github.event.client_payload.name }} ${{ github.event.client_payload.version }}"
git push --force https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git HEAD:versions
```

### Tests

```bash
python -m unittest
```
14 changes: 0 additions & 14 deletions dependabot.yml

This file was deleted.

3 changes: 2 additions & 1 deletion qgis_plugin_repo/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def merge(self):
self.output_parser.remove(element)

print(f"Adding new version {plugin.name} {plugin.experimental} {plugin.version}")
self.output_parser.append(self.plugin_element(self.input_parser, plugin.name, plugin.experimental))
self.output_parser.append(
self.plugin_element(self.input_parser, plugin.name, plugin.experimental))

self.output_tree.write(self.destination.absolute())

0 comments on commit dd64ef8

Please sign in to comment.