Merge pull request #367 from mcarlton00/artifact-name

Refactor pipeline
This commit is contained in:
Odd Stråbø 2020-08-22 23:16:24 +02:00 committed by GitHub
commit b89b9e0499
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 23 deletions

View file

@ -1,9 +1,20 @@
# 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
trigger:
batch: true
branches:
include:
- '*'
tags:
include:
- '*'
steps:
# On every PR, build the addon and make it available for download as an artifact
- template: build.yml
parameters:
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,26 @@ steps:
- script: python3 jellyfin-kodi/.config/generate_xml.py ${{ py_version }}
displayName: 'Create ${{ py_version }} addon.xml'
- task: CopyFiles@2
displayName: 'Create clean addon directory'
inputs:
sourceFolder: 'jellyfin-kodi'
contents: |
**/*
!.ci
!.config
!.git
!.github
!.gitignore
!requirements-dev.txt
!tests
!tox.ini
TargetFolder: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin'
- task: ArchiveFiles@2
displayName: 'Create ${{ py_version }} zip file'
inputs:
rootFolderOrFile: jellyfin-kodi
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin'
includeRootFolder: False
archiveType: 'zip'
tarCompression: 'none'
@ -28,22 +44,6 @@ steps:
- task: PublishPipelineArtifact@1
displayName: 'Publish ${{ py_version }} artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin-${{ py_version }}.zip'
artifactName: 'plugin.video.jellyfin-${{ py_version }}-$(Build.BuildNumber).zip'
targetPath: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin'
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 }}'