Deploy ποΈ #5357
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: 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 }} |