Start a glossary #1555
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }} |