From 0a7cd00178ed673b0a33c033db0a8ae22d586b67 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Sun, 21 Jun 2020 20:38:34 +0200 Subject: [PATCH 1/2] Add release workflow This adds a release workflow to GitHub CI so that pushing a new release tag will automatically create a GitHub release and pushes out a Leia and Matrix release to Kodi. --- .github/workflows/release.yml | 76 +++++++++++++++++++++++++++++++++++ Makefile | 17 +++++++- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8b9a0204 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +name: Release +on: + push: + tags: + - 'v*' +jobs: + build: + name: Release plugin.video.vrt.nu + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build zip files + run: | + sudo apt-get install libxml2-utils + make multizip release=1 + - name: Get Krypton filename + id: get-krypton-filename + run: | + echo ::set-output name=krypton-filename::$(cd ..;ls plugin.video.vrt.nu*.zip | grep -v '+matrix.' | head -1) + - name: Get Matrix filename + id: get-matrix-filename + run: | + echo ::set-output name=matrix-filename::$(cd ..;ls plugin.video.vrt.nu*+matrix.*.zip | head -1) + - name: Get body + id: get-body + run: | + description=$(sed '1,/^## Releases$/d;/## v[0-9\.]* ([0-9-]*)/d;/^$/,$d' README.md) + echo $description + description="${description//'%'/'%25'}" + description="${description//$'\n'/'%0A'}" + description="${description//$'\r'/'%0D'}" + echo ::set-output name=body::$description + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: ${{ steps.get-body.outputs.body }} + draft: false + prerelease: false + - name: Upload Krypton/Leia zip + id: upload-krypton-zip + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: ${{ steps.get-krypton-filename.outputs.krypton-filename }} + asset_path: ../${{ steps.get-krypton-filename.outputs.krypton-filename }} + asset_content_type: application/zip + - name: Upload Matrix zip + id: upload-matrix-zip + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: ${{ steps.get-matrix-filename.outputs.matrix-filename }} + asset_path: ../${{ steps.get-matrix-filename.outputs.matrix-filename }} + asset_content_type: application/zip + - name: Generate distribution zip and submit to official kodi repository + id: kodi-addon-submitter + uses: xbmc/action-kodi-addon-submitter@v1.2 + with: + kodi-repository: repo-plugins + kodi-version: krypton + addon-id: plugin.video.vrt.nu + kodi-matrix: true + env: + GH_USERNAME: ${{secrets.GH_USERNAME}} + GH_TOKEN: ${{secrets.GH_TOKEN}} + EMAIL: ${{secrets.EMAIL}} diff --git a/Makefile b/Makefile index 19a742c9..b39d24d0 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,18 @@ export PYTHONPATH := $(CURDIR)/resources/lib/:$(CURDIR)/tests/ PYTHON := python +KODI_PYTHON_ABIS := 3.0.0 2.25.0 name = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml) version = $(shell xmllint --xpath 'string(/addon/@version)' addon.xml) git_branch = $(shell git rev-parse --abbrev-ref HEAD) git_hash = $(shell git rev-parse --short HEAD) -zip_name = $(name)-$(version)-$(git_branch)-$(git_hash).zip +ifdef release + zip_name = $(name)-$(version).zip +else + zip_name = $(name)-$(version)-$(git_branch)-$(git_hash).zip +endif + include_files = addon.xml LICENSE README.md resources/ include_paths = $(patsubst %,$(name)/%,$(include_files)) exclude_files = \*.new \*.orig \*.pyc \*.pyo @@ -65,6 +71,15 @@ build: clean cd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files) @echo -e "$(white)=$(blue) Successfully wrote package as: $(white)../$(zip_name)$(reset)" +multizip: clean + @-$(foreach abi,$(KODI_PYTHON_ABIS), \ + echo "cd /addon/requires/import[@addon='xbmc.python']/@version\nset $(abi)\nsave\nbye" | xmllint --shell addon.xml; \ + matrix=$(findstring $(abi), $(word 1,$(KODI_PYTHON_ABIS))); \ + if [ $$matrix ]; then version=$(version)+matrix.1; else version=$(version); fi; \ + echo "cd /addon/@version\nset $$version\nsave\nbye" | xmllint --shell addon.xml; \ + make build; \ + ) + codecov: @echo -e "$(white)=$(blue) Test codecov.yml syntax$(reset)" curl --data-binary @.codecov.yml https://codecov.io/validate From 68cee2c917db80282e5954a883ed3f9510ed43ed Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Sun, 21 Jun 2020 20:50:20 +0200 Subject: [PATCH 2/2] Remove vrt references --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 8 ++++---- tests/xbmcextra.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fe7be95..862ed65f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: uses: dagwieers/sonarcloud-github-action@more-options with: organization: add-ons - projectKey: add-ons_plugin.video.vrt.nu + projectKey: add-ons_service.upnext sources: resources/lib/ tests: tests/ env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b9a0204..e8fa1341 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: - 'v*' jobs: build: - name: Release plugin.video.vrt.nu + name: Release service.upnext runs-on: ubuntu-latest steps: - name: Checkout code @@ -17,11 +17,11 @@ jobs: - name: Get Krypton filename id: get-krypton-filename run: | - echo ::set-output name=krypton-filename::$(cd ..;ls plugin.video.vrt.nu*.zip | grep -v '+matrix.' | head -1) + echo ::set-output name=krypton-filename::$(cd ..;ls service.upnext*.zip | grep -v '+matrix.' | head -1) - name: Get Matrix filename id: get-matrix-filename run: | - echo ::set-output name=matrix-filename::$(cd ..;ls plugin.video.vrt.nu*+matrix.*.zip | head -1) + echo ::set-output name=matrix-filename::$(cd ..;ls service.upnext*+matrix.*.zip | head -1) - name: Get body id: get-body run: | @@ -68,7 +68,7 @@ jobs: with: kodi-repository: repo-plugins kodi-version: krypton - addon-id: plugin.video.vrt.nu + addon-id: service.upnext kodi-matrix: true env: GH_USERNAME: ${{secrets.GH_USERNAME}} diff --git a/tests/xbmcextra.py b/tests/xbmcextra.py index d82b8a89..9ff0dd1d 100644 --- a/tests/xbmcextra.py +++ b/tests/xbmcextra.py @@ -41,8 +41,8 @@ def uri_to_path(uri): def read_addon_xml(path): ''' Parse the addon.xml and return an info dictionary ''' info = dict( - path='./', # '/storage/.kodi/addons/plugin.video.vrt.nu', - profile='special://userdata', # 'special://profile/addon_data/plugin.video.vrt.nu/', + path='./', # '/storage/.kodi/addons/service.upnext', + profile='special://userdata', # 'special://profile/addon_data/service.upnext/', type='xbmc.python.pluginsource', )