-
Notifications
You must be signed in to change notification settings - Fork 478
130 lines (110 loc) · 3.78 KB
/
generate_sdk_ref.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Generate SDK references
on:
workflow_dispatch:
push:
branches:
- improved-api-refs
# - main
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
jobs:
is_new_sdk_ref:
name: Is new SDK reference?
runs-on: ubuntu-latest
outputs:
new_sdk_ref: ${{ steps.sdk-changes.outputs.new_sdk_ref }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Check if SDK changes
id: sdk-changes
run: |
IS_NEW_sdk_REF=$(./.github/scripts/is_new_sdk_ref.sh)
echo "new_sdk_ref=$IS_NEW_sdk_REF" >> "$GITHUB_OUTPUT"
sdk-changes:
name: SDK changes
needs: [is_new_sdk_ref]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 9.5
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Configure pnpm
run: |
pnpm config set auto-install-peers true
pnpm config set exclude-links-from-lockfile true
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
working-directory: ./packages/python-sdk
run: poetry install --no-interaction --no-root
- name: Generate Python SDK reference
id: python-sdk-ref
working-directory: ./packages/python-sdk
run: |
source .venv/bin/activate
./scripts/generate_sdk_ref.sh
- name: Generate JS SDK reference
id: js-sdk-ref
working-directory: packages/js-sdk
run: ./scripts/generate_sdk_ref.sh
- name: Generate CLI reference
id: cli-sdk-ref
working-directory: packages/cli
run: ./scripts/generate_sdk_ref.sh
- name: Clone Code Interpreter reference
run: |
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
cd code-interpreter
git sparse-checkout set sdk-reference
cp -r sdk-reference/* ../apps/web/src/app/\(docs\)/docs/sdk-reference/
cd ..
rm -rf code-interpreter
- name: Clone Desktop reference
run: |
git clone --depth 1 --filter=blob:none --sparse https://github.com/e2b-dev/desktop -b generate-api-reference-for-desktop-sdk-e2b-1236
cd desktop
git sparse-checkout set sdk-reference
cp -r sdk-reference/* ../apps/web/src/app/\(docs\)/docs/sdk-reference/
cd ..
rm -rf desktop
- name: Show docs file structure
run: tree apps/web/src/app/\(docs\)/docs/sdk-reference
- name: Commit new SDK reference versions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add apps/web/src/app/\(docs\)/docs/sdk-reference
git commit -m "[skip ci] Release new SDK reference doc versions" || exit 0
git push