Skip to content

DocGen

DocGen #2013

Workflow file for this run

name: DocGen
on:
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
name: Generate Documentation
steps:
- name: Checkout Docs
uses: actions/checkout@v3
with:
path: documentation
token: ${{ secrets.DXROBOT_PAT }}
ssh-key: ${{ secrets.DXROBOT_SK }}
ref: ${{ github.ref_name }}
- name: Checkout DevExtreme
uses: actions/checkout@v3
with:
path: devextreme
repository: devexpress/devextreme
ref: ${{ github.ref_name }}
- name: NPM - devextreme
working-directory: devextreme
run: |
npm ci
npm i devextreme-internal-tools@$(node -p "require('./package-lock').dependencies['devextreme-internal-tools'].version")
- name: NPM - devextreme-documentation
working-directory: documentation
run: npm i
#Generation
- name: Discover declarations
working-directory: devextreme
#TODO: Workaround. This should be removed following the changes in devextreme monorepo
run: |
if [[ ${{ github.ref_name }} == "23_2" ]]; then
npm run tools:discover-declarations
else
npm run discover-declarations -- --artifacts ./artifacts/internal-tools
fi
- name: Update topics
working-directory: documentation
run: npm run update-topics -- --artifacts ../devextreme/artifacts/internal-tools
- name: Generate additional topics
working-directory: documentation
run: npm run generate-extra-topic --artifacts ../devextreme/artifacts/internal-tools
- name: Generate Syntax metadata
working-directory: documentation
run: npm run generate-syntax-data -- --artifacts ../devextreme/artifacts/internal-tools
- name: Generate ContentMap
working-directory: documentation
run: npm run generate-content-map --artifacts ../devextreme/artifacts/internal-tools
- name: Update links
working-directory: documentation
run: npm run update-links --artifacts ../devextreme/artifacts/internal-tools
#PR
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "DX Robot"
- name: Publish changes
working-directory: documentation
shell: bash
run: |
formatted_time=$(date +"%d_%m_%y_%Hh%Mm")
branch_name="dxrobot/${{ github.ref_name }}_D$formatted_time"
git checkout -b $branch_name
git add ./api-reference ./concepts ./metadata
git commit -m "DocGen ${{ github.ref_name }} result" || exit 0
git push --set-upstream origin $branch_name
escaped_pwd=$(echo $(pwd)/ | sed --expression 's/\//\\\//g')
cat ../devextreme/artifacts/internal-tools/Readme.md | sed -e "s/$escaped_pwd//g" > prbody.md
MAXSIZE=65536
FILESIZE=$(stat -c%s prbody.md)
if ((FILESIZE > MAXSIZE)); then
printf "Shown 64k bytes of total $FILESIZE\n$(tail -c 65490 prbody.md)" > prbody.md
fi
jq -n \
--arg head "$branch_name" \
--arg base "${{ github.ref_name }}" \
--arg title "DocGen ${{ github.ref_name }} [$(date +%D)]" \
--rawfile body prbody.md \
'{ "head": $head, "base": $base, "title": $title, "body": $body }' > prdata.json
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.DXROBOT_PAT }}" \
https://api.github.com/repos/${{ github.repository }}/pulls \
--data-binary @prdata.json
- name: Archive internal-tools artifacts
uses: actions/upload-artifact@v3
with:
name: internal-tools-artifacts
path: ./devextreme/artifacts/internal-tools/
retention-days: 7