mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
84 lines
2.7 KiB
YAML
84 lines
2.7 KiB
YAML
name: Publish
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows:
|
|
- Build
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
publish:
|
|
name: Deploy to Cloudflare Pages
|
|
if: ${{ always() }}
|
|
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: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
|
|
with:
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
name: jellyfin-web__prod
|
|
path: dist
|
|
|
|
- name: Publish
|
|
id: cf
|
|
uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # 1
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
projectName: jellyfin-web
|
|
branch: ${{ env.TARGET_BRANCH }}
|
|
directory: dist
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
compose-comment:
|
|
name: Compose comment
|
|
if: ${{ always() }}
|
|
uses: ./.github/workflows/job-messages.yml
|
|
needs:
|
|
- publish
|
|
|
|
with:
|
|
branch: ${{ needs.publish.outputs.branch }}
|
|
commit: ${{ github.event.workflow_run.head_commit.id }}
|
|
preview_url: ${{ needs.publish.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/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
|
|
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 }}
|
|
mode: recreate
|