From d55cf49bf28945a01bee2ef082523a10cd5a2585 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 21 Aug 2020 18:55:22 -0400 Subject: [PATCH 1/3] Change artifact name --- .ci/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.yml b/.ci/build.yml index 26006fc7..6a078aae 100644 --- a/.ci/build.yml +++ b/.ci/build.yml @@ -29,7 +29,7 @@ steps: displayName: 'Publish ${{ py_version }} artifact' inputs: targetPath: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin-${{ py_version }}.zip' - artifactName: 'plugin.video.jellyfin-${{ py_version }}-$(Build.BuildNumber).zip' + artifactName: 'plugin.video.jellyfin-${{ py_version }}-$(Build.BuildNumber)' - task: CopyFilesOverSSH@0 displayName: 'Upload to repo server' From 1691c32f507144d689121d1b6585b21462c0753a Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 21 Aug 2020 22:42:48 -0400 Subject: [PATCH 2/3] Rework pipeline --- .ci/azure-pipelines.yml | 19 +++++++++++++++---- .ci/build.yml | 38 ++++++++++++++++++++------------------ .ci/publish.yml | 19 +++++++++++++++++++ 3 files changed, 54 insertions(+), 22 deletions(-) create mode 100644 .ci/publish.yml diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 754303a7..25448ed1 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -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' ] diff --git a/.ci/build.yml b/.ci/build.yml index 6a078aae..68d1d318 100644 --- a/.ci/build.yml +++ b/.ci/build.yml @@ -16,10 +16,28 @@ 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 + !.editorconfig + !.env + !.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 +46,6 @@ steps: - task: PublishPipelineArtifact@1 displayName: 'Publish ${{ py_version }} artifact' inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/plugin.video.jellyfin-${{ py_version }}.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') diff --git a/.ci/publish.yml b/.ci/publish.yml new file mode 100644 index 00000000..c52d1b60 --- /dev/null +++ b/.ci/publish.yml @@ -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 }}' From ba31cc1ad1c249a0bc23636d8aafa44fa2cbcc93 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 22 Aug 2020 16:22:43 -0400 Subject: [PATCH 3/3] Include dev files in zip archive --- .ci/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.ci/build.yml b/.ci/build.yml index 68d1d318..39fd9488 100644 --- a/.ci/build.yml +++ b/.ci/build.yml @@ -24,8 +24,6 @@ steps: **/* !.ci !.config - !.editorconfig - !.env !.git !.github !.gitignore