Upload docs #1175
This file contains hidden or 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: Upload docs | |
| on: | |
| workflow_run: | |
| workflows: ["build docs (PR)"] | |
| types: | |
| - completed | |
| jobs: | |
| upload: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download docs from GH artifacts | |
| id: download-artifact | |
| uses: dawidd6/action-download-artifact@v6 | |
| with: | |
| name: docs | |
| workflow: docs_pr.yaml | |
| allow_forks: true | |
| workflow_conclusion: success | |
| - name: Upload docs for preview | |
| shell: bash | |
| run: | | |
| ls -alh | |
| PR_NBR=$(cat pr_number.txt) | |
| curl --data-binary @site.tar.gz -H "Authorization: Bearer ${{ secrets.UPLOAD_TOKEN }}" https://docs.tds.cscs.ch/upload?path=$PR_NBR | |
| - name: Post comment with preview URL | |
| shell: bash | |
| run: | | |
| PR_NBR=$(cat pr_number.txt) | |
| curl -L -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/eth-cscs/cscs-docs/issues/${PR_NBR}/comments" \ | |
| -d "{ \"body\": \"preview available: https://docs.tds.cscs.ch/${PR_NBR}\" }" |