-
Notifications
You must be signed in to change notification settings - Fork 23
82 lines (69 loc) · 2.46 KB
/
upload-sdk-artifact.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Generate and upload latest SDK artifacts
on:
push:
branches:
- master
env:
NODE_VERSION: 20.x
SDK_VERSION: latest
jobs:
start-backend-and-upload-swagger-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Pull MongoDB Image
run: |
docker pull mongo:latest
docker run -d --name mongo-container -p 27017:27017 mongo:latest
- name: Install Backend and wait for it to be ready
env:
MONGODB_URI: "mongodb://localhost:27017/scicat"
JWT_SECRET: thisIsTheJwtSecret
run: |
npm install -g wait-on && npm install
npm run start & wait-on http://localhost:3000/api/v3/health --timeout 200000
- name: Download the Swagger schema
run: curl -o ./swagger-schema.json http://localhost:3000/explorer-json
- uses: actions/upload-artifact@v4
with:
name: swagger-schema
path: ./swagger-schema.json
generate-and-upload-sdk:
runs-on: ubuntu-latest
needs:
- start-backend-and-upload-swagger-schema
strategy:
matrix:
generator: [python, typescript-angular, python-pydantic-v1]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: swagger-schema
path: .
- name: Generate Client
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: ${{ matrix.generator }}
openapi-file: ./swagger-schema.json
config-file: .github/openapi/${{ matrix.generator }}-config.json
command-args: |
-o ./sdk/${{ matrix.generator }} $(
if [ "${{ matrix.generator }}" == "typescript-angular" ]; then
echo "--additional-properties=npmVersion=${{env.SDK_VERSION}}";
elif [ "${{ matrix.generator }}" == "python" ]; then
echo "--additional-properties=packageVersion=${{env.SDK_VERSION}}";
elif [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
echo "--additional-properties=packageVersion=${{env.SDK_VERSION}}";
fi
)
- uses: actions/upload-artifact@v4
with:
name: sdk-${{ matrix.generator }}-${{ github.sha }}
path: ./sdk