Skip to content

Commit

Permalink
* make cli script create dirs and mv mdx files
Browse files Browse the repository at this point in the history
* add commit step to workflow
  • Loading branch information
github-actions[bot] authored and 0div committed Sep 24, 2024
1 parent 426d4ac commit 9d1d075
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/generate_api_ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ jobs:
working-directory: packages/cli
run: ./scripts/generate_api_ref.sh

- name: Show all generated api references
- name: Commit new SDK API reference versions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -l packages/python-sdk/api_ref
ls -l packages/js-sdk/api_ref
ls -l packages/cli/api_ref
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -am "[skip ci] Release new SDK API reference doc versions" || exit 0
git push
24 changes: 14 additions & 10 deletions packages/cli/scripts/generate_api_ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ mkdir -p api_ref

npx tsup && echo && NODE_ENV=development node dist/index.js -cmd2md

PKG_VERSION=$(node -p "require('./package.json').version")

# move to docs (for later use)
#for file in api_ref/*.md; do
# # Extract the filename without extension
# filename=$(basename "$file" .md)
#
# # Create the directory if it doesn't exist
# mkdir -p "../../apps/web/src/app/(docs)/docs/api-reference/cli/$filename"
#
# # Move the file to the new location and rename it to page.mdx
# mv "$file" "../../apps/web/src/app/(docs)/docs/api-reference/cli/$filename/page.mdx"
#done
for file in api_ref/*.md; do
# Extract the filename without extension
filename=$(basename "$file" .md)

# Create the directory if it doesn't exist
mkdir -p "../../apps/web/src/app/(docs)/docs/api-reference/cli/${PKG_VERSION}/${filename}"

# Move the file to the new location and rename it to page.mdx
mv "$file" "../../apps/web/src/app/(docs)/docs/api-reference/cli/${PKG_VERSION}/${filename}/page.mdx"
done

rm -rf api_ref

0 comments on commit 9d1d075

Please sign in to comment.