Skip to content

Commit

Permalink
seperate pnpm step from build docs ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mtuchi committed Aug 16, 2023
1 parent 0d9b7f3 commit 1797a87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,35 @@
mkdir -p tmp
rm -rf tmp/*

# Setup pnpm
pnpm install --frozen-lockfile

# build new docs
pnpm build:adaptors docs

# copy new packages docs files to the root docs directory
# rsync -pr packages/*/docs/ docs/
# rsync -av --progress packages/* docs/ --exclude node_modules --exclude src --exclude ast.json --exclude CHANGELOG.md --exclude test --exclude LICENSE --exclude LICENSE.LESSER --exclude package.json --exclude configuration-schema.json
rsync -zvr packages/ tmp/ --include="*.md" --include="*/" --exclude="*" --prune-empty-dirs

# move index.md to root directory
find tmp/*/docs -name '*.md' -type f -execdir mv -n '{}' ../ \;
find tmp/*/* -type d -empty -delete;
find tmp/*/* -type d -empty -delete

# flatten json files
# jq -s 'flatten' packages/*/docs/*.json > docs/docs.json
rm tmp/*.json
# add first opening bracked
echo [ >> tmp/tmp.json
echo [ >>tmp/tmp.json
# use all json files in current folder
for i in packages/*/docs/*.json
do
for i in packages/*/docs/*.json; do
# first create the key; it is the filename without the extension
# echo \"$i\": | sed 's/\.json//' >> output/tmp.json
# dump the file's content
cat "$i" >> tmp/tmp.json
cat "$i" >>tmp/tmp.json
# add a comma afterwards
echo , >> tmp/tmp.json
echo , >>tmp/tmp.json
done
# remove the last comma from the file; otherwise it's not valid json
cat tmp/tmp.json | sed '$ s/.$//' >> tmp/docs.json
cat tmp/tmp.json | sed '$ s/.$//' >>tmp/docs.json
# remove tempfile
rm tmp/tmp.json
# add closing bracket
echo ] >> tmp/docs.json
echo ] >>tmp/docs.json

# commit new docs
git fetch origin docs
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ jobs:
run: git config user.email $GH_EMAIL
env:
GH_EMAIL: ${{ secrets.GH_EMAIL }}
- name: Build docs to docs branch
- name: Installing packages
run: pnpm install --frozen-lockfile
- name: Build docs
run: pnpm build:adaptors docs
- name: Commit docs to docs branch
run: pnpm exec .github/workflows/docs.sh

# Trigger a rebuild on the docs site to pull adaptor docs
Expand Down

0 comments on commit 1797a87

Please sign in to comment.