-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (48 loc) · 1.44 KB
/
sdk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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' }}