-
Notifications
You must be signed in to change notification settings - Fork 68
64 lines (55 loc) · 2.01 KB
/
api-docs.yml
File metadata and controls
64 lines (55 loc) · 2.01 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
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: sap/cloud-sdk-js/.github/actions/setup@main
with:
registry-token: ${{ secrets.NPM_TOKEN_ARTIFACTORY }}
- name: Generate API documentation
run: |
pnpm run generate
pnpm run doc
- id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
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 }}
FULL_VERSION: ${{ inputs.version }}
run: |
gh auth setup-git
git config --global user.email "$BOT_EMAIL"
git config --global user.name "$BOT_NAME"
# Extract major version from input (e.g., v4.5.0 -> v4)
# shellcheck disable=SC2001
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