Rework pipeline

This commit is contained in:
Matt 2020-08-21 22:42:48 -04:00
parent d55cf49bf2
commit 1691c32f50
3 changed files with 54 additions and 22 deletions

View file

@ -1,9 +1,20 @@
# Starter pipeline trigger:
# Start with a minimal pipeline that you can customize to build and deploy your code. batch: true
# Add steps that build, run tests, deploy, and more: branches:
# https://aka.ms/yaml include:
- '*'
tags:
include:
- '*'
steps: steps:
# On every PR, build the addon and make it available for download as an artifact
- template: build.yml - template: build.yml
parameters: parameters:
py_versions: [ 'py2', 'py3' ] py_versions: [ 'py2', 'py3' ]
# When triggered by a tag, publish the built addon to the repo server
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags') }}:
- template: publish.yml
parameters:
py_versions: [ 'py2', 'py3' ]

View file

@ -16,10 +16,28 @@ steps:
- script: python3 jellyfin-kodi/.config/generate_xml.py ${{ py_version }} - script: python3 jellyfin-kodi/.config/generate_xml.py ${{ py_version }}
displayName: 'Create ${{ py_version }} addon.xml' displayName: 'Create ${{ py_version }} addon.xml'
- task: CopyFiles@2
displayName: 'Create clean addon directory'
inputs:
sourceFolder: 'jellyfin-kodi'
contents: |
**/*
!.ci
!.config
!.editorconfig
!.env
!.git
!.github
!.gitignore
!requirements-dev.txt
!tests
!tox.ini
TargetFolder: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin'
- task: ArchiveFiles@2 - task: ArchiveFiles@2
displayName: 'Create ${{ py_version }} zip file' displayName: 'Create ${{ py_version }} zip file'
inputs: inputs:
rootFolderOrFile: jellyfin-kodi rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin'
includeRootFolder: False includeRootFolder: False
archiveType: 'zip' archiveType: 'zip'
tarCompression: 'none' tarCompression: 'none'
@ -28,22 +46,6 @@ steps:
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: 'Publish ${{ py_version }} artifact' displayName: 'Publish ${{ py_version }} artifact'
inputs: inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin-${{ py_version }}.zip' targetPath: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin'
artifactName: 'plugin.video.jellyfin-${{ py_version }}-$(Build.BuildNumber)' artifactName: 'plugin.video.jellyfin-${{ py_version }}-$(Build.BuildNumber)'
- task: CopyFilesOverSSH@0
displayName: 'Upload to repo server'
inputs:
sshEndpoint: repository
sourceFolder: '$(Build.ArtifactStagingDirectory)'
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')

19
.ci/publish.yml Normal file
View file

@ -0,0 +1,19 @@
parameters:
python_version : []
steps:
- ${{ each py_version in parameters.py_versions }}:
- task: CopyFilesOverSSH@0
displayName: 'Upload to repo server'
inputs:
sshEndpoint: repository
sourceFolder: '$(Build.ArtifactStagingDirectory)'
contents: 'plugin.video.jellyfin-${{ py_version }}.zip'
targetFolder: '/srv/repository/incoming/kodi'
- 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 }}'