DocGen #1931
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DocGen | |
on: | |
workflow_dispatch: | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
name: Generate Documentation | |
steps: | |
- name: Checkout Docs | |
uses: actions/checkout@v2 | |
with: | |
path: documentation | |
token: ${{ secrets.DXROBOT_PAT }} | |
ssh-key: ${{ secrets.DXROBOT_SK }} | |
ref: ${{ github.ref_name }} | |
- name: Checkout DevExtreme | |
uses: actions/checkout@v2 | |
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 | |
run: npm run discover-declarations -- --artifacts ../artifacts/internal-tools | |
- name: Update topics | |
working-directory: documentation | |
run: npm run update-topics -- --artifacts ../artifacts/internal-tools | |
- name: Generate additional topics | |
working-directory: documentation | |
run: npm run generate-extra-topic --artifacts ../artifacts/internal-tools | |
- name: Generate Syntax metadata | |
working-directory: documentation | |
run: npm run generate-syntax-data -- --artifacts ../artifacts/internal-tools | |
- name: Generate ContentMap | |
working-directory: documentation | |
run: npm run generate-content-map --artifacts ../artifacts/internal-tools | |
- name: Update links | |
working-directory: documentation | |
run: npm run update-links --artifacts ../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 ../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: artifacts/internal-tools/ | |
retention-days: 7 |