Merge pull request #336 from mcarlton00/it's-automagical

Azure pipeline + revamp release process
This commit is contained in:
Odd Stråbø 2020-08-09 00:52:13 +02:00 committed by GitHub
commit 1f0364b5c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 151 additions and 11 deletions

9
.ci/azure-pipelines.yml Normal file
View file

@ -0,0 +1,9 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
steps:
- template: build.yml
parameters:
py_versions: [ 'py2', 'py3' ]

43
.ci/build.yml Normal file
View file

@ -0,0 +1,43 @@
parameters:
python_versions : []
steps:
- ${{ each py_version in parameters.py_versions }}:
- task: usePythonVersion@0
inputs:
versionSpec: '3.6'
- checkout: self
clean: true
- script: python3 -m pip install --user pyyaml
displayName: 'Install PyYaml'
- script: python3 jellyfin-kodi/.config/generate_xml.py ${{ py_version }}
displayName: 'Create ${{ py_version }} addon.xml'
- task: ArchiveFiles@2
displayName: 'Create ${{ py_version }} zip file'
inputs:
rootFolderOrFile: jellyfin-kodi
includeRootFolder: False
archiveType: 'zip'
tarCompression: 'none'
archiveFile: 'plugin.video.jellyfin-${{ py_version }}.zip'
- task: CopyFilesOverSSH@0
displayName: 'Upload to repo server'
inputs:
sshEndpoint: repository
sourceFolder: '${Agent.BuildDirectory}'
contents: 'plugin.video.jellyfin-${{ py-version }}.zip'
targetFolder: '/srv/repository/incoming/kodi'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- task: SSH@0
displayName: 'Add to Kodi repo'
inputs:
sshEndpoint: repository
runOptions: 'commands'
commands: 'sudo -n python3 /usr/local/bin/kodirepo add /srv/repository/incoming/kodi/plugin.video.jellyfin-${{ py_version }} --datadir /srv/repository/releases/client/kodi/${{ py_version }}'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')

67
.config/generate_xml.py Normal file
View file

@ -0,0 +1,67 @@
import xml.etree.ElementTree as ET
import yaml
import sys
import os
from datetime import datetime
def indent(elem, level=0):
'''
Nicely formats output xml with newlines and spaces
https://stackoverflow.com/a/33956544
'''
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i
try:
py_version = sys.argv[1]
except IndexError:
print('No version specified')
sys.exit(1)
dir_path = os.path.dirname(os.path.realpath(__file__))
# Load template file
with open(f'{dir_path}/template.xml', 'r') as f:
tree = ET.parse(f)
root = tree.getroot()
# Load version dependencies
with open(f'{dir_path}/{py_version}.yaml', 'r') as f:
deps = yaml.safe_load(f)
# Load version and changelog
with open('jellyfin-kodi/release.yaml', 'r') as f:
data = yaml.safe_load(f)
# Populate xml template
for dep in deps:
ET.SubElement(root.find('requires'), 'import', attrib=dep)
# Update version string
addon_version = data.get('version')
root.attrib['version'] = f'{addon_version}+{py_version}'
# Changelog
date = datetime.today().strftime('%Y-%m-%d')
changelog = data.get('changelog')
for section in root.findall('extension'):
news = section.findall('news')
if news:
news[0].text = f'v{addon_version} ({date}):\n{changelog}'
# Format xml tree
indent(root)
# Write addon.xml
tree.write('jellyfin-kodi/addon.xml', encoding='utf-8', xml_declaration=True)

14
.config/py2.yaml Normal file
View file

@ -0,0 +1,14 @@
- addon: 'xbmc.python'
version: '2.25.0'
- addon: 'script.module.requests'
version: '2.22.0'
- addon: 'script.module.dateutil'
version: '2.8.1'
- addon: 'script.module.six'
version: '1.13.0'
- addon: 'script.module.kodi-six'
version: '0.0.7'
- addon: 'script.module.addon.signals'
version: '0.0.5'
- addon: 'script.module.futures'
version: '2.2.0'

12
.config/py3.yaml Normal file
View file

@ -0,0 +1,12 @@
- addon: 'xbmc.python'
version: '3.0.0'
- addon: 'script.module.requests'
version: '2.22.0+matrix.1'
- addon: 'script.module.dateutil'
version: '2.8.1+matrix.1'
- addon: 'script.module.six'
version: '1.14.0+matrix.2'
- addon: 'script.module.kodi-six'
version: '0.1.3+1'
- addon: 'script.module.addon.signals'
version: '0.0.5+matrix.1'

View file

@ -1,16 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.jellyfin" <addon id="plugin.video.jellyfin"
name="Jellyfin" name="Jellyfin"
version="0.5.8" version=""
provider-name="Jellyfin Contributors, angelblue05"> provider-name="Jellyfin Contributors, angelblue05">
<requires> <requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.requests" version="2.22.0"/>
<import addon="script.module.dateutil" version="2.7.3"/>
<import addon="script.module.six" version="1.13.0"/>
<import addon="script.module.kodi-six" />
<import addon="script.module.addon.signals" version="0.0.1"/>
<import addon="script.module.futures" version="2.2.0"/>
</requires> </requires>
<extension point="xbmc.python.pluginsource" <extension point="xbmc.python.pluginsource"
library="default.py"> library="default.py">
@ -35,13 +28,11 @@
<language>en</language> <language>en</language>
<license>GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007</license> <license>GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007</license>
<forum>https://forum.jellyfin.org</forum> <forum>https://forum.jellyfin.org</forum>
<website>https://jellyfin.media/</website> <website>https://jellyfin.org/</website>
<source>https://github.com/jellyfin/jellyfin-kodi</source> <source>https://github.com/jellyfin/jellyfin-kodi</source>
<summary lang="en"></summary> <summary lang="en"></summary>
<description lang="en">Welcome to Jellyfin for Kodi!&#10;A whole new way to manage and view your media library. The Jellyfin addon for Kodi combines the best of Kodi - ultra smooth navigation, beautiful UIs and playback of any file under the sun, and Jellyfin - the most powerful fully open source multi-client media metadata indexer and server.&#10;&#10;Jellyfin for Kodi is the absolute best way to enjoy the incredible Kodi playback engine combined with the power of Jellyfin's centralized database. Features:&#10;* Direct integration with the Kodi library for native Kodi speed&#10;* Instant synchronization with the Jellyfin server&#10;* Full support for Movie, TV and Music collections&#10;* Jellyfin Server direct stream and transcoding support - use Kodi when you are away from home!</description> <description lang="en">Welcome to Jellyfin for Kodi!&#10;A whole new way to manage and view your media library. The Jellyfin addon for Kodi combines the best of Kodi - ultra smooth navigation, beautiful UIs and playback of any file under the sun, and Jellyfin - the most powerful fully open source multi-client media metadata indexer and server.&#10;&#10;Jellyfin for Kodi is the absolute best way to enjoy the incredible Kodi playback engine combined with the power of Jellyfin's centralized database. Features:&#10;* Direct integration with the Kodi library for native Kodi speed&#10;* Instant synchronization with the Jellyfin server&#10;* Full support for Movie, TV and Music collections&#10;* Jellyfin Server direct stream and transcoding support - use Kodi when you are away from home!</description>
<news> <news>
v0.5.8 (2020-06-15)
#322 Force filter parameter during incremental sync
</news> </news>
<assets> <assets>
<icon>resources/icon.png</icon> <icon>resources/icon.png</icon>

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ machine_guid
.vscode/ .vscode/
pyinstrument/ pyinstrument/
pyinstrument_cext.so pyinstrument_cext.so
addon.xml

3
release.yaml Normal file
View file

@ -0,0 +1,3 @@
version: '0.5.8'
changelog: |
#322 Force filter parameter during incremental sync