mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 10:44:23 -04:00
Merge pull request #4070 from crobibero/ci-api-client
Add ci task to publish api client
This commit is contained in:
commit
cb94b5a944
62
.ci/azure-pipelines-api-client.yml
Normal file
62
.ci/azure-pipelines-api-client.yml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
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/unstable.sh'
|
||||||
|
|
||||||
|
- 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/stable.sh'
|
||||||
|
|
||||||
|
- 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
|
@ -61,3 +61,6 @@ jobs:
|
|||||||
|
|
||||||
- ${{ if or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')) }}:
|
- ${{ if or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')) }}:
|
||||||
- template: azure-pipelines-package.yml
|
- template: azure-pipelines-package.yml
|
||||||
|
|
||||||
|
- ${{ if or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')) }}:
|
||||||
|
- template: azure-pipelines-api-client.yml
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -276,3 +276,4 @@ BenchmarkDotNet.Artifacts
|
|||||||
web/
|
web/
|
||||||
web-src.*
|
web-src.*
|
||||||
MediaBrowser.WebDashboard/jellyfin-web
|
MediaBrowser.WebDashboard/jellyfin-web
|
||||||
|
apiclient/generated
|
||||||
|
2
apiclient/.openapi-generator-ignore
Normal file
2
apiclient/.openapi-generator-ignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Prevent generator from creating these files:
|
||||||
|
git_push.sh
|
30
apiclient/templates/typescript/axios/package.mustache
Normal file
30
apiclient/templates/typescript/axios/package.mustache
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "@jellyfin/client-axios",
|
||||||
|
"version": "10.7.0{{snapshotVersion}}",
|
||||||
|
"description": "Jellyfin api client using axios",
|
||||||
|
"author": "Jellyfin Contributors",
|
||||||
|
"keywords": [
|
||||||
|
"axios",
|
||||||
|
"typescript",
|
||||||
|
"jellyfin"
|
||||||
|
],
|
||||||
|
"license": "GPL-3.0-only",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"typings": "./dist/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc --outDir dist/",
|
||||||
|
"prepublishOnly": "npm run build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.19.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.11.5",
|
||||||
|
"typescript": "^3.6.4"
|
||||||
|
}{{#npmRepository}},{{/npmRepository}}
|
||||||
|
{{#npmRepository}}
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "{{npmRepository}}"
|
||||||
|
}
|
||||||
|
{{/npmRepository}}
|
||||||
|
}
|
9
apiclient/templates/typescript/axios/stable.sh
Normal file
9
apiclient/templates/typescript/axios/stable.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/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"
|
9
apiclient/templates/typescript/axios/unstable.sh
Normal file
9
apiclient/templates/typescript/axios/unstable.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/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/"
|
Loading…
x
Reference in New Issue
Block a user