Skip to content

Commit

Permalink
Merge pull request #7 from DPS0340/main
Browse files Browse the repository at this point in the history
Implement ts-fetch sdk generation
  • Loading branch information
1eedaegon authored Aug 30, 2024
2 parents 616733a + d650259 commit e20b305
Show file tree
Hide file tree
Showing 52 changed files with 6,640 additions and 25 deletions.
69 changes: 44 additions & 25 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,6 @@ jobs:
with:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org'
# TODO: Migrate into matrix
- name: Generate typescript-axios sdk using openapi.yaml
run: >
npx @openapitools/openapi-generator-cli generate
-i ./generated/openapi.yaml
-o ./generated/sdk/ts-axios-out
-g typescript-axios
- name: Move sdk definitions into npm package using template
run: >
mkdir -p ./generated/sdk &&
rm -rf ./generated/sdk/ts-axios ;
cp -r ./template/sdk/ts-axios ./generated/sdk/ts-axios &&
mv ./generated/sdk/ts-axios-out/* ./generated/sdk/ts-axios-out/.* ./generated/sdk/ts-axios &&
rmdir ./generated/sdk/ts-axios-out
- name: Commit sdk definitions
uses: stefanzweifel/git-auto-commit-action@v5
- name: Publish ts-axios sdk into npm
run: >
cd ./generated/sdk/ts-axios &&
npm publish --provenance --access public --tag ${{ github.sha }}
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Compile redoc static pages
run: >
mkdir -p ./generated/docs ;
Expand All @@ -76,14 +53,56 @@ jobs:
uses: actions/[email protected]
with:
path: ./generated/docs

deploy-github-pages:
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: save-and-upload-openapi-yaml
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

generate-and-publish-sdks-to-npm:
runs-on: ubuntu-24.04
needs: save-and-upload-openapi-yaml
strategy:
max-parallel: 1
matrix:
sdk:
- type: typescript-axios
type-shorthand: ts-axios
- type: typescript-fetch
type-shorthand: ts-fetch
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org'
- name: Generate typescript-axios sdk using openapi.yaml
run: >
npx @openapitools/openapi-generator-cli generate
-i ./generated/openapi.yaml
-o ./generated/sdk/${{ matrix.sdk.type-shorthand }}-out
-g ${{ matrix.sdk.type }}
- name: Move sdk definitions into npm package using template
run: >
mkdir -p ./generated/sdk &&
rm -rf ./generated/sdk/${{ matrix.sdk.type-shorthand }} ;
cp -r ./template/sdk/${{ matrix.sdk.type-shorthand }} ./generated/sdk/${{ matrix.sdk.type-shorthand }} &&
mv ./generated/sdk/${{ matrix.sdk.type-shorthand }}-out/* ./generated/sdk/${{ matrix.sdk.type-shorthand }}-out/.* ./generated/sdk/${{ matrix.sdk.type-shorthand }} &&
rmdir ./generated/sdk/${{ matrix.sdk.type-shorthand }}-out
- name: Commit sdk definitions
uses: stefanzweifel/git-auto-commit-action@v5
- name: Publish ${{ matrix.sdk.type-shorthand }} sdk into npm
run: >
cd ./generated/sdk/${{ matrix.sdk.type-shorthand }} &&
npm publish --provenance --access public --tag ${{ github.sha }}
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

23 changes: 23 additions & 0 deletions generated/sdk/ts-fetch/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
47 changes: 47 additions & 0 deletions generated/sdk/ts-fetch/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.openapi-generator-ignore
apis/Pipeline1eedaegonGithubIoV1Api.ts
apis/index.ts
index.ts
models/IoGithub1eedaegonPipelineV1Pipeline.ts
models/IoGithub1eedaegonPipelineV1PipelineList.ts
models/IoGithub1eedaegonPipelineV1PipelineSpec.ts
models/IoGithub1eedaegonPipelineV1PipelineSpecHistoryLimit.ts
models/IoGithub1eedaegonPipelineV1PipelineSpecResource.ts
models/IoGithub1eedaegonPipelineV1PipelineSpecResourceGpu.ts
models/IoGithub1eedaegonPipelineV1PipelineSpecSchedule.ts
models/IoGithub1eedaegonPipelineV1PipelineSpecTasksInner.ts
models/IoGithub1eedaegonPipelineV1PipelineSpecVolumesInner.ts
models/IoGithub1eedaegonPipelineV1PipelineStatus.ts
models/IoGithub1eedaegonPipelineV1Run.ts
models/IoGithub1eedaegonPipelineV1RunList.ts
models/IoGithub1eedaegonPipelineV1RunSpec.ts
models/IoGithub1eedaegonPipelineV1RunSpecJobsInner.ts
models/IoGithub1eedaegonPipelineV1RunStatus.ts
models/IoGithub1eedaegonPipelineV1RunStatusJobStatesInner.ts
models/IoGithub1eedaegonPipelineV1Task.ts
models/IoGithub1eedaegonPipelineV1TaskList.ts
models/IoGithub1eedaegonPipelineV1TaskSpec.ts
models/IoGithub1eedaegonPipelineV1TaskStatus.ts
models/IoK8sApimachineryPkgApisMetaV1APIGroup.ts
models/IoK8sApimachineryPkgApisMetaV1APIGroupList.ts
models/IoK8sApimachineryPkgApisMetaV1APIResource.ts
models/IoK8sApimachineryPkgApisMetaV1APIResourceList.ts
models/IoK8sApimachineryPkgApisMetaV1APIVersions.ts
models/IoK8sApimachineryPkgApisMetaV1Condition.ts
models/IoK8sApimachineryPkgApisMetaV1DeleteOptions.ts
models/IoK8sApimachineryPkgApisMetaV1GroupVersionForDiscovery.ts
models/IoK8sApimachineryPkgApisMetaV1LabelSelector.ts
models/IoK8sApimachineryPkgApisMetaV1LabelSelectorRequirement.ts
models/IoK8sApimachineryPkgApisMetaV1ListMeta.ts
models/IoK8sApimachineryPkgApisMetaV1ManagedFieldsEntry.ts
models/IoK8sApimachineryPkgApisMetaV1ObjectMeta.ts
models/IoK8sApimachineryPkgApisMetaV1OwnerReference.ts
models/IoK8sApimachineryPkgApisMetaV1Preconditions.ts
models/IoK8sApimachineryPkgApisMetaV1ServerAddressByClientCIDR.ts
models/IoK8sApimachineryPkgApisMetaV1Status.ts
models/IoK8sApimachineryPkgApisMetaV1StatusCause.ts
models/IoK8sApimachineryPkgApisMetaV1StatusDetails.ts
models/IoK8sApimachineryPkgApisMetaV1WatchEvent.ts
models/IoK8sApimachineryPkgVersionInfo.ts
models/index.ts
runtime.ts
1 change: 1 addition & 0 deletions generated/sdk/ts-fetch/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.8.0
Loading

0 comments on commit e20b305

Please sign in to comment.