2020-09-06 05:32:21 +00:00
|
|
|
parameters:
|
|
|
|
- name: LinuxImage
|
|
|
|
type: string
|
|
|
|
default: "ubuntu-latest"
|
|
|
|
- name: GeneratorVersion
|
|
|
|
type: string
|
2020-10-02 14:21:28 +00:00
|
|
|
default: "5.0.0-beta2"
|
2020-09-06 05:32:21 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
- job: GenerateApiClients
|
|
|
|
displayName: 'Generate Api Clients'
|
2020-10-02 14:00:57 +00:00
|
|
|
dependsOn: Test
|
2020-09-06 05:32:21 +00:00
|
|
|
|
|
|
|
pool:
|
|
|
|
vmImage: "${{ parameters.LinuxImage }}"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- task: DownloadPipelineArtifact@2
|
|
|
|
displayName: 'Download OpenAPI Spec Artifact'
|
|
|
|
inputs:
|
2020-10-02 13:00:57 +00:00
|
|
|
source: 'current'
|
2020-09-06 05:32:21 +00:00
|
|
|
artifact: "OpenAPI Spec"
|
2020-10-02 13:00:57 +00:00
|
|
|
path: "$(System.ArtifactsDirectory)/openapispec"
|
|
|
|
runVersion: "latest"
|
2020-09-06 05:32:21 +00:00
|
|
|
|
|
|
|
- task: CmdLine@2
|
2020-10-02 14:00:57 +00:00
|
|
|
displayName: 'Download OpenApi Generator'
|
|
|
|
inputs:
|
|
|
|
script: "wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${{ parameters.GeneratorVersion }}/openapi-generator-cli-${{ parameters.GeneratorVersion }}.jar -O openapi-generator-cli.jar"
|
2020-09-06 05:32:21 +00:00
|
|
|
|
2020-10-15 00:16:58 +00:00
|
|
|
## Authenticate with npm registry
|
|
|
|
- task: npmAuthenticate@0
|
|
|
|
inputs:
|
|
|
|
workingFile: ./.npmrc
|
|
|
|
customEndpoint: 'jellyfin-bot for NPM'
|
|
|
|
|
2020-10-09 15:52:05 +00:00
|
|
|
## Generate npm api client
|
2020-09-06 05:32:21 +00:00
|
|
|
# Unstable
|
|
|
|
- task: CmdLine@2
|
2020-10-02 14:00:57 +00:00
|
|
|
displayName: 'Build unstable typescript axios client'
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
|
|
|
inputs:
|
2020-10-04 23:03:39 +00:00
|
|
|
script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory) $(Build.BuildNumber)"
|
2020-09-06 05:32:21 +00:00
|
|
|
|
2020-10-09 15:52:05 +00:00
|
|
|
# Stable
|
|
|
|
- task: CmdLine@2
|
|
|
|
displayName: 'Build stable typescript axios client'
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
|
|
|
inputs:
|
|
|
|
script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory)"
|
|
|
|
|
|
|
|
## Run npm install
|
|
|
|
- task: Npm@1
|
|
|
|
displayName: 'Install npm dependencies'
|
|
|
|
inputs:
|
|
|
|
command: install
|
|
|
|
workingDir: ./apiclient/generated/typescript/axios
|
|
|
|
|
|
|
|
## Publish npm packages
|
|
|
|
# Unstable
|
2020-09-06 05:32:21 +00:00
|
|
|
- task: Npm@1
|
2020-10-02 14:00:57 +00:00
|
|
|
displayName: 'Publish unstable typescript axios client'
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
|
|
|
inputs:
|
|
|
|
command: publish
|
|
|
|
publishRegistry: useFeed
|
2020-10-09 14:51:22 +00:00
|
|
|
publishFeed: 'jellyfin/unstable'
|
2020-10-02 14:00:57 +00:00
|
|
|
workingDir: ./apiclient/generated/typescript/axios
|
2020-09-06 05:32:21 +00:00
|
|
|
|
|
|
|
# Stable
|
|
|
|
- task: Npm@1
|
2020-10-02 14:00:57 +00:00
|
|
|
displayName: 'Publish stable typescript axios client'
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
|
|
|
inputs:
|
|
|
|
command: publish
|
|
|
|
publishRegistry: useExternalRegistry
|
|
|
|
publishEndpoint: 'jellyfin-bot for NPM'
|
|
|
|
workingDir: ./apiclient/generated/typescript/axios
|