Create a CI job to release the add-on

The CI job will take care of all the steps to create a new release in
GitLab:
* creation of the tag
* create of the release object with the release notes
All the required information will be extracted from the addon.xml file.

A "pre-release" job is also added to validate the changes in addon.xml
before the actual release is done.

All these steps are explained in the contribution guidelines.

Finally the files TESTME.md and createaddon.sh are removed since the
installation steps are explained in the wiki and the archive of the
add-on is created automatically by GitLab in the release.

See merge request StCyr/plugin.video.peertube!12 for more information
This commit is contained in:
Thomas 2021-04-11 20:40:44 +00:00
parent c723ced0c6
commit f138f2595a
5 changed files with 83 additions and 42 deletions

48
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,48 @@
stages:
- validation
- release
# Create YAML anchors to avoid code duplicate (note: an anchor cannot call
# another anchor as it will result in an array of array)
.apt_get_update: &apt_get_update
- apt-get update > /dev/null
.release_script_prep: &release_script_prep
- apt-get install --yes python3-dev python3-pip git > /dev/null
- git clone https://framagit.org/thombet/scripts-for-kodi-add-ons.git
- python3 -m pip --quiet install -r scripts-for-kodi-add-ons/create-new-add-on-release/requirements.txt
# Pre-release job: will be available in all the merge requests with release
# branches in order to verify the release can be actually created. The
# verification is done by running the release script in dry run mode.
pre-release:
stage: validation
# Do not get any artifacts from previous jobs
dependencies: []
rules:
# Run this job only on merge requests for release branches
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^release\//'
when: manual
before_script:
- *apt_get_update
- *release_script_prep
script:
- python3 scripts-for-kodi-add-ons/create-new-add-on-release/create-new-add-on-release.py --dry-run
# Release job: will create a new GitLab release with the latest commit on the
# main branch.
create-release:
stage: release
# Do not get any artifacts from previous jobs
dependencies: []
# Run this job only for new commits on the branch "main" and only as "manual"
# because it is not mandatory to release all the commits on mainline.
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: manual
- when: never
before_script:
- *apt_get_update
- *release_script_prep
script:
- python3 scripts-for-kodi-add-ons/create-new-add-on-release/create-new-add-on-release.py

View File

@ -1,7 +1,10 @@
A Kodi add-on for watching content hosted on [PeerTube](http://joinpeertube.org/).
This code is under development but some basic features work, and you're welcome
to improve it.
This add-on is under development so only basic features work, and you're
welcome to improve it.
See [contribution guidelines](contributing.md) and
[pending issues](https://framagit.org/StCyr/plugin.video.peertube/-/issues) to
start.
[[_TOC_]]

View File

@ -1,11 +0,0 @@
Under debian install kodi 17 or above and python-libtorrent library
apt install kodi
apt install python-libtorrent
then create a zip from this content using :
./createaddon.sh
Then follow kodi https://kodi.wiki/view/Add-on_manager#How_to_install_from_a_ZIP_file from the created file.

30
contributing.md Normal file
View File

@ -0,0 +1,30 @@
# Contribution Guidelines
Thank you for deciding to contribute to this project :)
Please follow these guidelines when implementing your code.
[[_TOC_]]
## Coding style
The code is still based on the design of the alpha version.
A redesign is planned but until then please follow these rules:
* document the usage of functions following [Sphinx format](https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#python-signatures)
## How to release a new version of this add-on
These steps should be followed only by maintainers.
1. Create a release branch whose name follows this format:
`release/<release_name>`
2. On this branch don't commit any new feature. Only commit changes related to
the release process like:
- a bump of the add-on version in `addon.xml` (note that the version
numbering must follow the [semantic versioning](https://semver.org/))
- the update of the changelog in the `news` tag in `addon.xml` (using
Markdown syntax since it will be re-used automatically in the release
notes)
3. Merge the merge request (maintainers only)
4. A new pipeline with the job `create-release` will be created: run the job
manually since it should be `blocked` (maintainers only)
5. The new release will be available on the releases page.

View File

@ -1,29 +0,0 @@
#!/bin/bash
echo "Create a zip package to be able to install it in kodi as external source"
package=plugin.video.peertube
# very lazzy pattern extraction from addon.xml
version=$(grep "name=\"PeerTube\" version=" addon.xml | sed 's/^.*version="\([^"]*\).*$/\1/g')
zip_package=$package-$version.zip
if [[ -d $package ]]
then
echo "[ERROR] '$package' directory does already exists, please remove it or move it away" >&2
exit 1
fi
if [[ -e $zip_package ]]
then
echo "[WARNING] '$zip_package' zip already exists, it will be updated. Please remove it or move it away or change version in addon.xml next time..." >&2
fi
mkdir $package
cp -r addon.xml icon.png fanart.jpg peertube.py LICENSE.txt resources/ service.py $package
zip -r $zip_package $package
echo
echo "[INFO] '$(pwd)/$zip_package' created. You can import it in kodi"