-
Notifications
You must be signed in to change notification settings - Fork 66
70 lines (58 loc) · 2.13 KB
/
api-docs.yml
File metadata and controls
70 lines (58 loc) · 2.13 KB
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
name: api-docs
on:
workflow_call:
inputs:
version:
description: 'Version to generate docs for'
required: true
type: string
workflow_dispatch:
inputs:
version:
description: 'Version to generate docs for'
required: true
type: string
jobs:
generate-and-push-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: git fetch --depth=1
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22
cache: 'yarn'
- run: yarn install --frozen-lockfile --ignore-engines
- name: Generate API documentation
run: |
yarn generate
yarn doc
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
with:
client-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
owner: SAP
repositories: cloud-sdk
permission-contents: write
- name: Push generated API documentation to cloud-sdk repo
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_USER: cloud-sdk-js
BOT_EMAIL: ${{ vars.SAP_CLOUD_SDK_BOT_EMAIL }}
BOT_NAME: ${{ vars.SAP_CLOUD_SDK_BOT_NAME }}
run: |
gh auth setup-git
git config user.email "$BOT_EMAIL"
git config user.name "$BOT_NAME"
# Extract major version from input (e.g., v4.5.0 -> v4)
FULL_VERSION="${{ inputs.version }}"
MAJOR_VERSION=$(echo $FULL_VERSION | sed 's/\(v[0-9]*\).*/\1/')
cd ..
git clone --depth 1 https://github.com/SAP/cloud-sdk.git
# Copy generated docs to versioned folder
rsync -avz --delete cloud-sdk-js/knowledge-base/api-reference/ cloud-sdk/static/api/${MAJOR_VERSION}/
cd cloud-sdk
git add -A
git commit -m "Update SAP Cloud SDK for JavaScript API documentation ${MAJOR_VERSION}" || exit 0
git push