Skip to content

Commit

Permalink
feat: add support for typescript-fetch SDK and update typescript-angu…
Browse files Browse the repository at this point in the history
…lar configuration (#1556)

* feat: add support for typescript-fetch SDK and update typescript-angular configuration

* correct the sdk name

* handle extra spaces
  • Loading branch information
Junjiequan authored Dec 11, 2024
1 parent 4730537 commit 99adf12
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/openapi/typescript-angular-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"generatorName": "typescript-angular",
"npmName": "@scicatproject/scicat-sdk-ts",
"npmName": "@scicatproject/scicat-sdk-ts-angular",
"ngVersion": "16.2.12",
"withInterfaces": true
}
5 changes: 5 additions & 0 deletions .github/openapi/typescript-fetch-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"generatorName": "typescript-fetch",
"npmName": "@scicatproject/scicat-sdk-ts-fetch",
"supportsES6": true
}
26 changes: 15 additions & 11 deletions .github/workflows/release-and-publish-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ jobs:
--git-repo-id scicat-backend-next \
--git-user-id SciCatProject \
-o ./sdk/${{ matrix.generator }} $(
if [ "${{ matrix.generator }}" == "typescript-angular" ]; then
if [ "${{ matrix.generator }}" == "typescript-angular" ] || [ "${{ matrix.generator }}" == "typescript-fetch" ]; then
echo "--additional-properties=npmVersion=${{ needs.build-release.outputs.new_tag}}";
elif [ "${{ matrix.generator }}" == "python" ]; then
echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}";
elif [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
elif [ "${{ matrix.generator }}" == "python" ] || [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}";
fi
)
Expand All @@ -169,9 +167,12 @@ jobs:
npm-publish:
needs: generate-upload-sdk
runs-on: ubuntu-latest
strategy:
matrix:
sdk_type: [typescript-angular, typescript-fetch]
environment:
name: npm-sdk-package
url: https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts
name: ${{ matrix.sdk_type }}-sdk-package
url: ${{ matrix.sdk_type == 'typescript-angular' && 'https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts-angular' || 'https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts-fetch' }}

steps:
- name: Checkout repository
Expand All @@ -183,19 +184,22 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org/"

- name: Download TypeScript Angular SDK Artifact
- name: Download TypeScript SDK Artifact
uses: actions/download-artifact@v4
with:
name: sdk-typescript-angular-${{github.sha}}
name: sdk-${{ matrix.sdk_type }}-${{ github.sha }}
path: ./sdk

- name: Publish package
run: |
npm install
npm run build
cd dist
if [ "${{ matrix.sdk_type }}" == "typescript-angular" ]; then
# publish dist folder for typescript-angular
cd dist
fi
npm publish --access public
working-directory: ./sdk/typescript-angular/
working-directory: ./sdk/${{ matrix.sdk_type }}/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down Expand Up @@ -223,7 +227,7 @@ jobs:
- name: Download Python SDK Artifact
uses: actions/download-artifact@v4
with:
name: sdk-${{ matrix.sdk_type }}-${{github.sha}}
name: sdk-${{ matrix.sdk_type }}-${{ github.sha }}
path: ./sdk

- name: Install dependencies
Expand Down

0 comments on commit 99adf12

Please sign in to comment.