|
3 | 3 | push:
|
4 | 4 | branches:
|
5 | 5 | - master
|
| 6 | + pull_request: |
| 7 | + |
6 | 8 |
|
7 | 9 | jobs:
|
8 | 10 | build-and-deploy:
|
|
69 | 71 | git clean -dfx
|
70 | 72 | cd ..
|
71 | 73 | - name: Publish docs
|
| 74 | + if: ${{ github.ref == 'refs/heads/master' }} |
72 | 75 | shell: bash -l {0}
|
73 | 76 | run: |
|
74 | 77 | git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
|
|
80 | 83 | mv ~/docs/* .
|
81 | 84 | git add .
|
82 | 85 | git config --global user.name 'github-actions[doc-deploy-bot]'
|
83 |
| - git config --gloabl user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com' |
| 86 | + git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com' |
84 | 87 | git commit -m "Latest docs."
|
85 | 88 | git push tokened_docs gh-pages
|
| 89 | + - name: Publish pull-request docs |
| 90 | + if: ${{ github.ref != 'refs/heads/master' }} |
| 91 | + env: |
| 92 | + PR_NUM: ${{ github.event.number }} |
| 93 | + shell: bash -l {0} |
| 94 | + run: | |
| 95 | + git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git |
| 96 | + git fetch tokened_docs |
| 97 | + git checkout --track tokened_docs/gh-pages |
| 98 | + echo `pwd` |
| 99 | + [ -d pulls/${PR_NUM} ] && git rm -rf pulls/${PR_NUM} |
| 100 | + mkdir -p pulls/${PR_NUM} |
| 101 | + cd pulls/${PR_NUM} |
| 102 | + mv ~/docs/* . |
| 103 | + git add . |
| 104 | + git config --global user.name 'github-actions[doc-deploy-bot]' |
| 105 | + git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com' |
| 106 | + git commit -m "Docs for pull request ${PR_NUM}" |
| 107 | + git push tokened_docs gh-pages |
| 108 | + - name: Comment with URL to pull-request docs |
| 109 | + if: ${{ github.ref != 'refs/heads/master' }} |
| 110 | + env: |
| 111 | + PR_NUM: ${{ github.event.number }} |
| 112 | + uses: mshick/add-pr-comment@v1 |
| 113 | + with: |
| 114 | + message: | |
| 115 | + View rendered docs @ https://intelpython.github.io/dpctl/pulls/${PR_NUM}/index.html |
| 116 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 117 | + repo-token-user-login: 'github-actions[bot]' |
0 commit comments