This repository was archived by the owner on Oct 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify repository so HEAD contains the Matrix version (#100)
- Loading branch information
1 parent
bcb5cac
commit 16bb1ce
Showing
16 changed files
with
397 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,17 +11,12 @@ jobs: | |
kodi-addon-checker: | ||
name: Addon checker | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
kodi-version: [ leia, matrix ] | ||
steps: | ||
- name: Check out ${{ github.sha }} from repository ${{ github.repository }} | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run kodi-addon-checker | ||
uses: xbmc/[email protected] | ||
with: | ||
kodi-version: ${{ matrix.kodi-version }} | ||
rewrite-for-matrix: ${{ matrix.kodi-version == 'matrix' }} | ||
kodi-version: matrix | ||
addon-id: ${{ github.event.repository.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,22 +6,13 @@ on: | |
jobs: | ||
build: | ||
name: Release plugin.video.viervijfzes | ||
if: startsWith(github.ref, 'refs/tags/') # prevent from running if it's not a tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
- name: Check out ${{ github.sha }} from repository ${{ github.repository }} | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build zip files | ||
id: build | ||
run: | | ||
sudo apt-get install libxml2-utils | ||
make multizip release=1 | ||
echo ::set-output name=leia-filename::$(cd ..;ls plugin.video.viervijfzes*.zip | grep -v '+matrix.' | head -1) | ||
echo ::set-output name=matrix-filename::$(cd ..;ls plugin.video.viervijfzes*+matrix.*.zip | head -1) | ||
- name: Get body | ||
id: get-body | ||
- name: Get changelog | ||
id: get-changelog | ||
run: | | ||
description=$(sed '1,6d;/^## /,$d' CHANGELOG.md) | ||
echo $description | ||
|
@@ -30,47 +21,14 @@ jobs: | |
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.GH_TOKEN }} | ||
- name: Generate distribution zips | ||
run: scripts/build.py | ||
|
||
- name: Create Release on Github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: ${{ steps.get-body.outputs.body }} | ||
body: ${{ steps.get-changelog.outputs.body }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Leia zip | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_name: ${{ steps.build.outputs.leia-filename }} | ||
asset_path: ../${{ steps.build.outputs.leia-filename }} | ||
asset_content_type: application/zip | ||
|
||
- name: Upload Matrix zip | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_name: ${{ steps.build.outputs.matrix-filename }} | ||
asset_path: ../${{ steps.build.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 | ||
addon-id: plugin.video.viervijfzes | ||
kodi-version: leia | ||
kodi-matrix: true | ||
env: | ||
GH_USERNAME: ${{ secrets.GH_USERNAME }} | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
EMAIL: ${{ secrets.EMAIL }} | ||
files: "dist/*.zip" | ||
token: ${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ tests/home/userdata/addon_data | |
|
||
Pipfile | ||
Pipfile.lock | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
""" Build ZIP files for all brands. """ | ||
from __future__ import absolute_import, division, unicode_literals | ||
|
||
import os | ||
import shutil | ||
import sys | ||
import xml.etree.ElementTree as ET | ||
|
||
BRANDS_DIR = 'brands' | ||
DIST_DIR = 'dist' | ||
|
||
|
||
def get_files(): | ||
""" Get a list of files that we should package. """ | ||
# Start with all non-hidden files | ||
files = [f for f in os.listdir() if not f.startswith('.')] | ||
|
||
# Exclude files from .gitattributes | ||
with open('.gitattributes', 'r') as f: | ||
for line in f.read().splitlines(): | ||
filename, mode = line.split(' ') | ||
filename = filename.strip('/') | ||
if mode == 'export-ignore' and filename in files: | ||
files.remove(filename) | ||
|
||
# Exclude files from .gitignore. I know, this won't do matching | ||
with open('.gitignore', 'r') as f: | ||
for filename in f.read().splitlines(): | ||
filename = filename.strip('/') | ||
if filename in files: | ||
files.remove(filename) | ||
|
||
return files | ||
|
||
|
||
def modify_xml(file, version, news, python=None): | ||
""" Modify an addon.xml. """ | ||
with open(file, 'r+') as f: | ||
tree = ET.fromstring(f.read()) | ||
|
||
# Update values | ||
tree.set('version', version) | ||
tree.find("./extension[@point='xbmc.addon.metadata']/news").text = news | ||
if python: | ||
tree.find("./requires/import[@addon='xbmc.python']").set('version', python) | ||
|
||
# Save file | ||
f.seek(0) | ||
f.truncate() | ||
f.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' + | ||
ET.tostring(tree, encoding='UTF-8').decode()) | ||
|
||
|
||
if __name__ == '__main__': | ||
# Read base addon.xml info | ||
with open('addon.xml', 'r') as f: | ||
tree = ET.fromstring(f.read()) | ||
addon_info = { | ||
'id': tree.get('id'), | ||
'version': tree.get('version'), | ||
'news': tree.find("./extension[@point='xbmc.addon.metadata']/news").text | ||
} | ||
|
||
# Make sure dist folder exists | ||
if not os.path.isdir(DIST_DIR): | ||
os.mkdir(DIST_DIR) | ||
|
||
# Build addon | ||
brand = addon_info['id'] | ||
dest = os.path.join(DIST_DIR, brand) | ||
if not os.path.isdir(dest): | ||
os.mkdir(dest) | ||
|
||
# Copy files from add-on source | ||
for f in get_files(): | ||
if os.path.isfile(f): | ||
shutil.copy(f, dest) | ||
else: | ||
shutil.copytree(f, os.path.join(dest, f), dirs_exist_ok=True) | ||
|
||
# Update addon.xml for matrix and create zip | ||
modify_xml(os.path.join(dest, 'addon.xml'), addon_info['version'] + '+matrix.1', addon_info['news']) | ||
shutil.make_archive(os.path.join(DIST_DIR, "%s-%s+matrix.1" % (brand, addon_info['version'])), 'zip', DIST_DIR, brand) | ||
|
||
# Modify addon.xml for leia and create zip | ||
modify_xml(os.path.join(dest, 'addon.xml'), addon_info['version'], addon_info['news'], '2.26.0') | ||
shutil.make_archive(os.path.join(DIST_DIR, "%s-%s" % (brand, addon_info['version'])), 'zip', DIST_DIR, brand) |
File renamed without changes.
Oops, something went wrong.