diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-10-05 15:11:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-05 15:11:06 +0200 |
| commit | fe9d25c26836442e93e2a6997e576de527265655 (patch) | |
| tree | 069f0af3421a900eec980ec3c43242bf9b348dfd | |
| parent | 40bbcb63db505cfcfdb7c5c7cf307348406794b8 (diff) | |
| parent | fc28ffea53861ea7e8c35d71dcf863e4900f4d8f (diff) | |
Merge pull request #4271 from joshuaboniface/fix-ci-script
Improve handling of apiclient generator
| -rw-r--r-- | .ci/azure-pipelines-api-client.yml | 4 | ||||
| -rw-r--r-- | apiclient/templates/typescript/axios/generate.sh | 19 | ||||
| -rw-r--r-- | apiclient/templates/typescript/axios/stable.sh | 9 | ||||
| -rw-r--r-- | apiclient/templates/typescript/axios/unstable.sh | 9 |
4 files changed, 21 insertions, 20 deletions
diff --git a/.ci/azure-pipelines-api-client.yml b/.ci/azure-pipelines-api-client.yml index 7f428aec1..d120593ea 100644 --- a/.ci/azure-pipelines-api-client.yml +++ b/.ci/azure-pipelines-api-client.yml @@ -34,7 +34,7 @@ jobs: displayName: 'Build unstable typescript axios client' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') inputs: - script: 'bash ./apiclient/templates/typescript/axios/unstable.sh' + script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory) $(Build.BuildNumber)" - task: Npm@1 displayName: 'Publish unstable typescript axios client' @@ -50,7 +50,7 @@ jobs: displayName: 'Build stable typescript axios client' condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') inputs: - script: 'bash ./apiclient/templates/typescript/axios/stable.sh' + script: "bash ./apiclient/templates/typescript/axios/generate.sh $(System.ArtifactsDirectory)" - task: Npm@1 displayName: 'Publish stable typescript axios client' diff --git a/apiclient/templates/typescript/axios/generate.sh b/apiclient/templates/typescript/axios/generate.sh new file mode 100644 index 000000000..c514b10d5 --- /dev/null +++ b/apiclient/templates/typescript/axios/generate.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +artifactsDirectory="${1}" +buildNumber="${2}" +if [[ -n ${buildNumber} ]]; then + # Unstable build + additionalProperties=",snapshotVersion=\"-SNAPSHOT.${buildNumber}\",npmRepository=\"https://pkgs.dev.azure.com/jellyfin-project/jellyfin/_packaging/unstable/npm/registry/\"" +else + # Stable build + additionalProperties="" +fi + +java -jar openapi-generator-cli.jar generate \ + --input-spec ${artifactsDirectory}/openapispec/openapi.json \ + --generator-name typescript-axios \ + --output ./apiclient/generated/typescript/axios \ + --template-dir ./apiclient/templates/typescript/axios \ + --ignore-file-override ./apiclient/.openapi-generator-ignore \ + --additional-properties=useSingleRequestParameter="true",withSeparateModelsAndApi="true",npmName="axios"${additionalProperties} diff --git a/apiclient/templates/typescript/axios/stable.sh b/apiclient/templates/typescript/axios/stable.sh deleted file mode 100644 index 118ef219f..000000000 --- a/apiclient/templates/typescript/axios/stable.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -java -jar openapi-generator-cli.jar generate \ - --input-spec $(System.ArtifactsDirectory)/openapispec/openapi.json \ - --generator-name typescript-axios \ - --output ./apiclient/generated/typescript/axios \ - --template-dir ./apiclient/templates/typescript/axios \ - --ignore-file-override ./apiclient/.openapi-generator-ignore \ - --additional-properties=useSingleRequestParameter="true",withSeparateModelsAndApi="true",npmName="axios" diff --git a/apiclient/templates/typescript/axios/unstable.sh b/apiclient/templates/typescript/axios/unstable.sh deleted file mode 100644 index be9f9be43..000000000 --- a/apiclient/templates/typescript/axios/unstable.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -java -jar openapi-generator-cli.jar generate \ - --input-spec $(System.ArtifactsDirectory)/openapispec/openapi.json \ - --generator-name typescript-axios \ - --output ./apiclient/generated/typescript/axios \ - --template-dir ./apiclient/templates/typescript/axios \ - --ignore-file-override ./apiclient/.openapi-generator-ignore \ - --additional-properties=useSingleRequestParameter="true",withSeparateModelsAndApi="true",npmName="axios",snapshotVersion="-SNAPSHOT.$(Build.BuildNumber)",npmRepository="https://pkgs.dev.azure.com/jellyfin-project/jellyfin/_packaging/unstable/npm/registry/" |
