Skip to content

Merge pull request #1310 from PhilanthropyDataCommons/dependabot/npm_… #1561

Merge pull request #1310 from PhilanthropyDataCommons/dependabot/npm_…

Merge pull request #1310 from PhilanthropyDataCommons/dependabot/npm_… #1561

Workflow file for this run

name: Build (sdk)
on:
workflow_dispatch:
pull_request:
push:
branches:
- 'main'
jobs:
typescript:
runs-on: ubuntu-latest
env:
npm_token_exists: ${{ secrets.NPM_TOKEN != '' }}
steps:
- name: Check out our code
uses: actions/checkout@v4
with:
path: 'service'
- name: Check out sdk generators
uses: actions/checkout@v4
with:
repository: 'PhilanthropyDataCommons/sdk'
path: 'sdk'
- name: Copy API definition
run: cp service/src/openapi.json sdk/openapi.json
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Invoke the TypeScript generator
working-directory: sdk
run: ./gradlew generateSwaggerCode
- name: Install dependencies for the TypeScript SDK
working-directory: sdk/build/typescript
run: npm ci
- name: Build the TypeScript SDK
working-directory: sdk/build/typescript
run: npm run build
- name: Publish to NPM if there is a new version
if: ${{ env.npm_token_exists == 'true' }}
uses: JS-DevTools/npm-publish@v3
with:
package: sdk/build/typescript
token: ${{ secrets.NPM_TOKEN }}
access: public
dry-run: ${{ github.event_name == 'pull_request' }}