Skip to content

Deploy πŸ—οΈ #5357

Deploy πŸ—οΈ

Deploy πŸ—οΈ #5357

Workflow file for this run

name: Deploy πŸ—οΈ
on:
workflow_run:
workflows:
# Deploy on pull requests
- Quality checks πŸ‘ŒπŸ§ͺ
# Deploy on all releases
- Release 🌍
types:
- completed
jobs:
cf-pages:
name: CloudFlare Pages πŸ“ƒ
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
# We set the environment variable here (and as an output) because,
# given no real runner is dispatched in compose-comment job (it's dispatched in the reusable workflow) in this workflow definition,
# the env. context is not valid.
env:
TARGET_BRANCH: |
${{
github.event.workflow_run.head_repository.full_name == github.repository
&& github.event.workflow_run.head_branch
|| format('{0}/{1}', github.event.workflow_run.head_repository.full_name, github.event.workflow_run.head_branch)
}}
outputs:
url: ${{ steps.cf.outputs.url }}
branch: ${{ env.TARGET_BRANCH }}
steps:
- name: Download workflow artifact ⬇️
uses: actions/[email protected]
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.JF_BOT_TOKEN }}
name: frontend
path: dist
- name: Publish to Cloudflare Pages πŸ“ƒ
uses: cloudflare/[email protected]
id: cf
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: jf-vue
directory: dist
branch: ${{ env.TARGET_BRANCH }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
compose-comment:
name: Compose comment πŸ“
if: ${{ always() }}
uses: ./.github/workflows/job_messages.yml
needs:
- cf-pages
with:
branch: ${{ needs.cf-pages.outputs.branch }}
commit: ${{ github.event.workflow_run.head_commit.id }}
preview_url: ${{ needs.cf-pages.outputs.url }}
build_workflow_run_id: ${{ github.event.workflow_run.id }}
commenting_workflow_run_id: ${{ github.run_id }}
in_progress: false
comment-status:
name: Create comment status πŸ“Š
if: ${{ always() && github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.pull_requests[0].number != '' }}
runs-on: ubuntu-latest
needs:
- compose-comment
steps:
- name: Update job summary in PR comment πŸ”ƒ
uses: thollander/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
message: ${{ needs.compose-comment.outputs.msg }}
pr_number: ${{ github.event.workflow_run.pull_requests[0].number }}
comment_tag: ${{ needs.compose-comment.outputs.marker }}