fc28ffea53
1. Replace the separate stable/unstable scripts with a single script and handle the difference with argument parsing. 2. Unify the calls and pass the Azure arguments in on the CLI.
63 lines
2.1 KiB
YAML
63 lines
2.1 KiB
YAML
parameters:
|
|
- name: LinuxImage
|
|
type: string
|
|
default: "ubuntu-latest"
|
|
- name: GeneratorVersion
|
|
type: string
|
|
default: "5.0.0-beta2"
|
|
|
|
jobs:
|
|
- job: GenerateApiClients
|
|
displayName: 'Generate Api Clients'
|
|
dependsOn: Test
|
|
|
|
pool:
|
|
vmImage: "${{ parameters.LinuxImage }}"
|
|
|
|
steps:
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: 'Download OpenAPI Spec Artifact'
|
|
inputs:
|
|
source: 'current'
|
|
artifact: "OpenAPI Spec"
|
|
path: "$(System.ArtifactsDirectory)/openapispec"
|
|
runVersion: "latest"
|
|
|
|
- task: CmdLine@2
|
|
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"
|
|
|
|
# Generate npm api client
|
|
# Unstable
|
|
- task: CmdLine@2
|
|
displayName: 'Build unstable typescript axios client'
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
|
inputs:
|
|
script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory) $(Build.BuildNumber)"
|
|
|
|
- task: Npm@1
|
|
displayName: 'Publish unstable typescript axios client'
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
|
inputs:
|
|
command: publish
|
|
publishRegistry: useFeed
|
|
publishFeed: unstable
|
|
workingDir: ./apiclient/generated/typescript/axios
|
|
|
|
# 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)"
|
|
|
|
- task: Npm@1
|
|
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
|