Skip to content

Commit

Permalink
Merge pull request #190 from dagwieers/release-workflow
Browse files Browse the repository at this point in the history
Add release workflow
  • Loading branch information
im85288 authored Jun 21, 2020
2 parents 7985d4f + 68cee2c commit 60b5c40
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Release service.upnext
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 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 service.upnext*+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/[email protected]
with:
kodi-repository: repo-plugins
kodi-version: krypton
addon-id: service.upnext
kodi-matrix: true
env:
GH_USERNAME: ${{secrets.GH_USERNAME}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
EMAIL: ${{secrets.EMAIL}}
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/xbmcextra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)

Expand Down

0 comments on commit 60b5c40

Please sign in to comment.