1
+ name : Generate SDK API references
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ branches :
7
+ - improved-api-refs
8
+ # - main
9
+
10
+ concurrency : ${{ github.workflow }}-${{ github.ref }}
11
+
12
+ permissions :
13
+ contents : write
14
+
15
+ jobs :
16
+ is_new_api_ref :
17
+ name : Is new API reference?
18
+ runs-on : ubuntu-latest
19
+ outputs :
20
+ new_api_ref : ${{ steps.sdk-changes.outputs.new_api_ref }}
21
+ steps :
22
+ - name : Checkout Repo
23
+ uses : actions/checkout@v3
24
+ with :
25
+ fetch-depth : 2
26
+
27
+ - name : Check if SDK changes
28
+ id : sdk-changes
29
+ run : |
30
+ IS_NEW_API_REF=$(./.github/scripts/is_new_api_ref.sh)
31
+ echo "new_api_ref=$IS_NEW_API_REF" >> "$GITHUB_OUTPUT"
32
+
33
+ sdk-changes :
34
+ name : SDK changes
35
+ needs : [is_new_api_ref]
36
+ if : always()
37
+ runs-on : ubuntu-latest
38
+ steps :
39
+ - name : Checkout repository
40
+ uses : actions/checkout@v3
41
+ with :
42
+ fetch-depth : 0
43
+
44
+ - name : Install pnpm
45
+ uses : pnpm/action-setup@v3
46
+ id : pnpm-install
47
+ with :
48
+ version : 9.5
49
+
50
+ - name : Setup Node
51
+ uses : actions/setup-node@v3
52
+ with :
53
+ node-version : " 20.x"
54
+ registry-url : " https://registry.npmjs.org"
55
+ cache : pnpm
56
+ cache-dependency-path : pnpm-lock.yaml
57
+
58
+ - name : Configure pnpm
59
+ run : |
60
+ pnpm config set auto-install-peers true
61
+ pnpm config set exclude-links-from-lockfile true
62
+
63
+ - name : Install dependencies
64
+ run : pnpm install --frozen-lockfile
65
+
66
+ - name : Set up Python
67
+ id : setup-python
68
+ uses : actions/setup-python@v5
69
+ with :
70
+ python-version : " 3.8"
71
+
72
+ - name : Install and configure Poetry
73
+ uses : snok/install-poetry@v1
74
+ with :
75
+ version : 1.5.1
76
+ virtualenvs-create : true
77
+ virtualenvs-in-project : true
78
+ installer-parallel : true
79
+
80
+ - name : Install dependencies
81
+ working-directory : ./packages/python-sdk
82
+ run : poetry install --no-interaction --no-root
83
+
84
+ - name : Generate Python SDK API reference
85
+ id : python-sdk-api-ref
86
+ working-directory : ./packages/python-sdk
87
+ run : |
88
+ source .venv/bin/activate
89
+ ./scripts/generate_api_ref.sh
90
+
91
+ - name : Generate JS SDK API reference
92
+ id : js-sdk-api-ref
93
+ working-directory : packages/js-sdk
94
+ run : ./scripts/generate_api_ref.sh
95
+
96
+ - name : Generate CLI API reference
97
+ id : cli-api-ref
98
+ working-directory : packages/cli
99
+ run : ./scripts/generate_api_ref.sh
100
+
101
+ - name : Show docs file structure
102
+ run : tree apps/web/src/app/\(docs\)/docs/api-reference
103
+
104
+ - name : Clone code-interpreter API reference
105
+ run : |
106
+ git clone --depth 1 --filter=blob:none --sparse https://github.com/e2b-dev/code-interpreter -b generate-api-reference-for-code-interpreter-sdk-e2b-1235
107
+ cd code-interpreter
108
+ git sparse-checkout set api-reference
109
+ cp -r api-reference/* ../apps/web/src/app/\(docs\)/docs/api-reference/
110
+ cd ..
111
+ rm -rf code-interpreter
112
+
113
+ - name : Commit new SDK API reference versions
114
+ env :
115
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
116
+ run : |
117
+ git config user.name "github-actions[bot]"
118
+ git config user.email "github-actions[bot]@users.noreply.github.com"
119
+ git add apps/web/src/app/\(docs\)/docs/api-reference
120
+ git commit -m "[skip ci] Release new SDK API reference doc versions" || exit 0
121
+ git push
0 commit comments