DocGen #4439
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@v3 | |
with: | |
path: documentation | |
token: ${{ secrets.DXROBOT_PAT }} | |
ssh-key: ${{ secrets.DXROBOT_SK }} | |
ref: ${{ github.ref_name }} | |
- name: Checkout Tools | |
uses: actions/checkout@v3 | |
with: | |
path: tools | |
repository: devexpress/devextreme-hgmirror-tools | |
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 update devextreme-internal-tools | |
- name: NPM - devextreme-documentation | |
working-directory: documentation | |
run: npm i | |
#Generation | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
3.1 | |
- name: Discover declarations | |
working-directory: devextreme | |
run: npm run discover-declarations -- --artifacts ../artifacts | |
- name: Update topics | |
working-directory: documentation | |
run: npm run update-topics -- --declarations-path ../artifacts/Declarations.json --artifacts ../artifacts | |
- name: Generate additional topics | |
working-directory: documentation | |
run: npm run generate-extra-topic | |
- name: Generate Syntax metadata | |
working-directory: documentation | |
run: npm run generate-syntax-data -- --declarations-path $(realpath ../artifacts/Declarations.json) | |
- name: Generate ContentMap | |
working-directory: documentation | |
run: npm run generate-content-map | |
- name: Update links | |
working-directory: documentation | |
run: npm run update-links | |
#Git | |
- name: Configure Git | |
run: | | |
git config --global user.email "${{ secrets.DXROBOT_EMAIL }}" | |
git config --global user.name "DX Robot" | |
#Tools | |
- name: Update Tools files | |
run: | | |
cp -f ./artifacts/Declarations.json ./tools/Declarations.json | |
cp -f ./artifacts/Descriptions.json ./tools/Descriptions.json | |
- name: Commit Tools files | |
working-directory: tools | |
run: | | |
git add ./Declarations.json ./Descriptions.json | |
git commit -m "DocGen ${{ github.ref_name }} result" || exit 0 | |
git push | |
#PR | |
- name: Publish changes | |
working-directory: documentation | |
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/Readme.md | sed -e "s/$escaped_pwd//g" > prbody.md | |
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 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: artifacts/* |