trigger preview #497
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: trigger preview | |
on: | |
workflow_run: | |
workflows: ["trigger build"] | |
types: [completed] | |
jobs: | |
get-pr-number: | |
runs-on: ubuntu-latest | |
outputs: | |
PR_NUMBER: ${{ steps.get-pr-number.outputs.PR_NUMBER }} | |
SHA: ${{ steps.get-pr-number.outputs.SHA }} | |
steps: | |
- name: Download PR number artifact | |
uses: dawidd6/action-download-artifact@v7 | |
with: | |
name: pr_number | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: trigger-build | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Read PR number | |
id: get-pr-number | |
run: | | |
tree . | |
cat pr_number.txt | |
{ read PR_NUMBER; read SHA; } < pr_number.txt | |
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT | |
echo "SHA=$SHA" >> $GITHUB_OUTPUT | |
make-or-find-preview-comment: | |
needs: get-pr-number | |
uses: './.github/workflows/preview-comment.yml' | |
with: | |
pr_number: ${{ needs.get-pr-number.outputs.PR_NUMBER }} | |
sha: ${{ needs.get-pr-number.outputs.SHA }} | |
no_update: 'true' | |
build-for-preview: | |
needs: get-pr-number | |
uses: './.github/workflows/build.yml' | |
with: | |
artifact_name: docs-zip-${{ needs.get-pr-number.outputs.PR_NUMBER }} | |
build_from_code_artifact: true | |
code_artifact_name: code-zip-${{ needs.get-pr-number.outputs.PR_NUMBER }} | |
deploy-preview: | |
needs: [get-pr-number, build-for-preview] | |
if: github.event.workflow_run.conclusion == 'success' | |
uses: './.github/workflows/gh-pages.yml' | |
with: | |
artifact_name: docs-zip-${{ needs.get-pr-number.outputs.PR_NUMBER }} | |
destination_dir: _preview/${{ needs.get-pr-number.outputs.PR_NUMBER }} # deploy to subdirectory labeled with PR number | |
preview-comment: | |
needs: [get-pr-number, deploy-preview, make-or-find-preview-comment] | |
uses: './.github/workflows/preview-comment.yml' | |
with: | |
pr_number: ${{ needs.get-pr-number.outputs.PR_NUMBER }} | |
sha: ${{ needs.get-pr-number.outputs.SHA }} |