aboutsummaryrefslogtreecommitdiff
path: root/.ci/azure-pipelines-api-client.yml
blob: 177f78889ce679703208ba7021403d53a3ae4c36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
parameters:
  - name: LinuxImage
    type: string
    default: "ubuntu-latest"
  - name: GeneratorVersion
    type: string
    default: "5.0.0-beta2"

jobs:
- job: GenerateApiClients
  displayName: 'Generate Api Clients'
  condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
  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"

## Authenticate with npm registry
    - task: npmAuthenticate@0
      inputs:
        workingFile: ./.npmrc
        customEndpoint: 'jellyfin-bot for NPM'

## Generate npm api client
    - task: CmdLine@2
      displayName: 'Build stable typescript axios client'
      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
    - task: Npm@1
      displayName: 'Publish stable typescript axios client'
      inputs:
        command: custom
        customCommand: publish --access public
        publishRegistry: useExternalRegistry
        publishEndpoint: 'jellyfin-bot for NPM'
        workingDir: ./apiclient/generated/typescript/axios