-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24663d2
commit e57c1b2
Showing
1 changed file
with
167 additions
and
193 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,197 +1,171 @@ | ||
trigger: | ||
batch: true | ||
branches: | ||
include: | ||
- '*' | ||
tags: | ||
include: | ||
- '*' | ||
batch: true | ||
branches: | ||
include: | ||
- '*' | ||
tags: | ||
include: | ||
- '*' | ||
pr: | ||
branches: | ||
include: | ||
- '*' | ||
branches: | ||
include: | ||
- '*' | ||
|
||
jobs: | ||
- job: Build | ||
displayName: 'Build' | ||
|
||
strategy: | ||
matrix: | ||
Development: | ||
BuildConfiguration: development | ||
Production: | ||
BuildConfiguration: production | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
displayName: 'Install Node' | ||
inputs: | ||
versionSpec: '12.x' | ||
|
||
- task: Cache@2 | ||
displayName: 'Check Cache' | ||
inputs: | ||
key: 'yarn | yarn.lock' | ||
path: 'node_modules' | ||
cacheHitVar: CACHE_RESTORED | ||
|
||
- script: 'yarn install --frozen-lockfile' | ||
displayName: 'Install Dependencies' | ||
condition: ne(variables.CACHE_RESTORED, 'true') | ||
|
||
- script: 'sh ./scripts/updateversion.sh' | ||
displayName: 'Update version in package.json' | ||
|
||
- script: 'yarn build:development' | ||
displayName: 'Build Development' | ||
condition: eq(variables['BuildConfiguration'], 'development') | ||
|
||
- script: 'yarn build:production' | ||
displayName: 'Build Bundle' | ||
condition: eq(variables['BuildConfiguration'], 'production') | ||
|
||
- script: 'test -d dist' | ||
displayName: 'Check Build' | ||
|
||
- script: 'mv dist jellyfin-chromecast' | ||
displayName: 'Rename Directory' | ||
|
||
- task: ArchiveFiles@2 | ||
displayName: 'Archive Directory' | ||
inputs: | ||
rootFolderOrFile: 'jellyfin-chromecast' | ||
includeRootFolder: true | ||
archiveFile: 'jellyfin-chromecast-$(BuildConfiguration)' | ||
|
||
- task: PublishPipelineArtifact@1 | ||
displayName: 'Publish Release' | ||
inputs: | ||
targetPath: '$(Build.SourcesDirectory)/jellyfin-chromecast-$(BuildConfiguration).zip' | ||
artifactName: 'jellyfin-chromecast-$(BuildConfiguration)' | ||
|
||
- job: Lint | ||
displayName: 'Lint' | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
displayName: 'Install Node' | ||
inputs: | ||
versionSpec: '12.x' | ||
|
||
- task: Cache@2 | ||
displayName: 'Check Cache' | ||
inputs: | ||
key: 'yarn | yarn.lock' | ||
path: 'node_modules' | ||
cacheHitVar: CACHE_RESTORED | ||
|
||
- script: 'yarn install --frozen-lockfile' | ||
displayName: 'Install Dependencies' | ||
condition: ne(variables.CACHE_RESTORED, 'true') | ||
|
||
- script: 'yarn run lint --quiet' | ||
displayName: 'Run ESLint' | ||
|
||
- job: Publish | ||
displayName: 'Publish' | ||
|
||
dependsOn: Build | ||
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) | ||
|
||
strategy: | ||
matrix: | ||
Development: | ||
BuildConfiguration: development | ||
Production: | ||
BuildConfiguration: production | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- script: 'echo "##vso[task.setvariable variable=TAG]$(git describe --tags)"' | ||
displayName: 'Set Tag Variable' | ||
|
||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download Artifact' | ||
inputs: | ||
source: 'current' | ||
artifact: 'jellyfin-chromecast-$(BuildConfiguration)' | ||
path: '$(System.ArtifactsDirectory)' | ||
runVersion: 'latest' | ||
|
||
- task: GithubRelease@0 | ||
displayName: 'GitHub Upload' | ||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') | ||
inputs: | ||
gitHubConnection: Jellyfin Release Download | ||
repositoryName: jellyfin/jellyfin-chromecast | ||
assets: '$(System.ArtifactsDirectory)/*.zip' | ||
action: 'edit' | ||
assetUploadMode: 'replace' | ||
tag: '$(TAG)' | ||
|
||
- task: CopyFilesOverSSH@0 | ||
displayName: 'Upload to Repository' | ||
inputs: | ||
sshEndpoint: repository | ||
sourceFolder: '$(System.ArtifactsDirectory)' | ||
contents: '**' | ||
targetFolder: '/srv/repository/releases/client/chromecast/versions/$(TAG)' | ||
|
||
- task: SSH@0 | ||
displayName: 'Symlink Latest Version' | ||
inputs: | ||
sshEndpoint: repository | ||
runOptions: 'inline' | ||
inline: 'cd /srv/repository/releases/client/chromecast && rm -rf *.zip && ln -s versions/$(TAG)/jellyfin-chromecast-$(BuildConfiguration)-$(TAG).zip .' | ||
|
||
- job: Production | ||
displayName: 'Production' | ||
|
||
dependsOn: Build | ||
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download Artifact' | ||
inputs: | ||
source: 'current' | ||
artifact: 'jellyfin-chromecast-production' | ||
path: '$(System.ArtifactsDirectory)' | ||
runVersion: 'latest' | ||
|
||
- task: ExtractFiles@1 | ||
displayName: "Extract Source" | ||
inputs: | ||
archiveFilePatterns: '$(System.ArtifactsDirectory)/*.zip' | ||
destinationFolder: '$(System.ArtifactsDirectory)/artifact' | ||
cleanDestinationFolder: true | ||
|
||
- task: CopyFilesOverSSH@0 | ||
displayName: 'Update Nightly' | ||
inputs: | ||
sshEndpoint: chromecast | ||
sourceFolder: '$(System.ArtifactsDirectory)/artifact/jellyfin-chromecast' | ||
cleanTargetFolder: true | ||
contents: '**' | ||
targetFolder: '/srv/chromecast/nightly' | ||
|
||
- task: CopyFilesOverSSH@0 | ||
displayName: 'Update Stable' | ||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') | ||
inputs: | ||
sshEndpoint: chromecast | ||
sourceFolder: '$(System.ArtifactsDirectory)/artifact/jellyfin-chromecast' | ||
cleanTargetFolder: true | ||
contents: '**' | ||
targetFolder: '/srv/chromecast/stable' | ||
- job: Build | ||
displayName: 'Build' | ||
|
||
strategy: | ||
matrix: | ||
Development: | ||
BuildConfiguration: development | ||
Production: | ||
BuildConfiguration: production | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
displayName: 'Install Node' | ||
inputs: | ||
versionSpec: '12.x' | ||
|
||
- task: Cache@2 | ||
displayName: 'Check Cache' | ||
inputs: | ||
key: 'yarn | yarn.lock' | ||
path: 'node_modules' | ||
cacheHitVar: CACHE_RESTORED | ||
|
||
- script: 'yarn install --frozen-lockfile' | ||
displayName: 'Install Dependencies' | ||
condition: ne(variables.CACHE_RESTORED, 'true') | ||
|
||
- script: 'sh ./scripts/updateversion.sh' | ||
displayName: 'Update version in package.json' | ||
|
||
- script: 'yarn build:development' | ||
displayName: 'Build Development' | ||
condition: eq(variables['BuildConfiguration'], 'development') | ||
|
||
- script: 'yarn build:production' | ||
displayName: 'Build Bundle' | ||
condition: eq(variables['BuildConfiguration'], 'production') | ||
|
||
- script: 'test -d dist' | ||
displayName: 'Check Build' | ||
|
||
- script: 'mv dist jellyfin-chromecast' | ||
displayName: 'Rename Directory' | ||
|
||
- task: ArchiveFiles@2 | ||
displayName: 'Archive Directory' | ||
inputs: | ||
rootFolderOrFile: 'jellyfin-chromecast' | ||
includeRootFolder: true | ||
archiveFile: 'jellyfin-chromecast-$(BuildConfiguration)' | ||
|
||
- task: PublishPipelineArtifact@1 | ||
displayName: 'Publish Release' | ||
inputs: | ||
targetPath: '$(Build.SourcesDirectory)/jellyfin-chromecast-$(BuildConfiguration).zip' | ||
artifactName: 'jellyfin-chromecast-$(BuildConfiguration)' | ||
|
||
- job: Publish | ||
displayName: 'Publish' | ||
|
||
dependsOn: Build | ||
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) | ||
|
||
strategy: | ||
matrix: | ||
Development: | ||
BuildConfiguration: development | ||
Production: | ||
BuildConfiguration: production | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- script: 'echo "##vso[task.setvariable variable=TAG]$(git describe --tags)"' | ||
displayName: 'Set Tag Variable' | ||
|
||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download Artifact' | ||
inputs: | ||
source: 'current' | ||
artifact: 'jellyfin-chromecast-$(BuildConfiguration)' | ||
path: '$(System.ArtifactsDirectory)' | ||
runVersion: 'latest' | ||
|
||
- task: GithubRelease@0 | ||
displayName: 'GitHub Upload' | ||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') | ||
inputs: | ||
gitHubConnection: Jellyfin Release Download | ||
repositoryName: jellyfin/jellyfin-chromecast | ||
assets: '$(System.ArtifactsDirectory)/*.zip' | ||
action: 'edit' | ||
assetUploadMode: 'replace' | ||
tag: '$(TAG)' | ||
|
||
- task: CopyFilesOverSSH@0 | ||
displayName: 'Upload to Repository' | ||
inputs: | ||
sshEndpoint: repository | ||
sourceFolder: '$(System.ArtifactsDirectory)' | ||
contents: '**' | ||
targetFolder: '/srv/repository/releases/client/chromecast/versions/$(TAG)' | ||
|
||
- task: SSH@0 | ||
displayName: 'Symlink Latest Version' | ||
inputs: | ||
sshEndpoint: repository | ||
runOptions: 'inline' | ||
inline: 'cd /srv/repository/releases/client/chromecast && rm -rf *.zip && ln -s versions/$(TAG)/jellyfin-chromecast-$(BuildConfiguration)-$(TAG).zip .' | ||
|
||
- job: Production | ||
displayName: 'Production' | ||
|
||
dependsOn: Build | ||
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
steps: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download Artifact' | ||
inputs: | ||
source: 'current' | ||
artifact: 'jellyfin-chromecast-production' | ||
path: '$(System.ArtifactsDirectory)' | ||
runVersion: 'latest' | ||
|
||
- task: ExtractFiles@1 | ||
displayName: 'Extract Source' | ||
inputs: | ||
archiveFilePatterns: '$(System.ArtifactsDirectory)/*.zip' | ||
destinationFolder: '$(System.ArtifactsDirectory)/artifact' | ||
cleanDestinationFolder: true | ||
|
||
- task: CopyFilesOverSSH@0 | ||
displayName: 'Update Nightly' | ||
inputs: | ||
sshEndpoint: chromecast | ||
sourceFolder: '$(System.ArtifactsDirectory)/artifact/jellyfin-chromecast' | ||
cleanTargetFolder: true | ||
contents: '**' | ||
targetFolder: '/srv/chromecast/nightly' | ||
|
||
- task: CopyFilesOverSSH@0 | ||
displayName: 'Update Stable' | ||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') | ||
inputs: | ||
sshEndpoint: chromecast | ||
sourceFolder: '$(System.ArtifactsDirectory)/artifact/jellyfin-chromecast' | ||
cleanTargetFolder: true | ||
contents: '**' | ||
targetFolder: '/srv/chromecast/stable' |