Skip to content

trigger-preview

trigger-preview #178

name: trigger-preview
on:
workflow_run:
workflows:
- trigger-book-build
types:
- requested
- completed
env:
ARM_USERNAME: ${{ secrets.ARM_USERNAME }}
ARM_PASSWORD: ${{ secrets.ARM_PASSWORD }}
jobs:
find-pull-request:
uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main
build-book-for-preview:
needs: find-pull-request
if: github.event.workflow_run.conclusion == 'success'
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
secrets:
ARM_USERNAME: ${{ secrets.ARM_USERNAME }}
ARM_PASSWORD: ${{ secrets.ARM_PASSWORD }}
with:
environment_name: cmip6-cookbook-dev
artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }}
build_from_code_artifact: "true"
code_artifact_name: code-zip-${{ needs.find-pull-request.outputs.number }}
deploy-preview:
needs: [find-pull-request, build-book-for-preview]
if: github.event.workflow_run.conclusion == 'success'
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main
with:
artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }}
destination_dir: _preview/${{ needs.find-pull-request.outputs.number }} # deploy to subdirectory labeled with PR number
is_preview: 'false' # it is a preview but deployed from main branch context
preview-comment:
needs: find-pull-request
uses: ProjectPythia/cookbook-actions/.github/workflows/preview-comment.yaml@main
with:
pull_request_number: ${{ needs.find-pull-request.outputs.number }}
sha: ${{ needs.find-pull-request.outputs.sha }}