diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml
index cbcb222216..0405a694e6 100644
--- a/.github/workflows/automation.yml
+++ b/.github/workflows/automation.yml
@@ -11,31 +11,7 @@ on:
pull_request_target:
jobs:
- compose-comment:
- name: Compose PR comment
- if: ${{ always() && !cancelled() && github.event_name == 'pull_request_target' }}
- uses: ./.github/workflows/job-messages.yml
- with:
- commit: ${{ github.event.pull_request.head.sha }}
- commenting_workflow_run_id: ${{ github.run_id }}
- in_progress: true
-
- push-comment:
- name: Push comment to PR
- if: ${{ always() && !cancelled() && github.event_name == 'pull_request_target' && needs.compose-comment.result == 'success' }}
- runs-on: ubuntu-latest
- needs:
- - compose-comment
-
- steps:
- - name: Create comment
- uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
- with:
- GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
- message: ${{ needs.compose-comment.outputs.msg }}
- comment_tag: ${{ needs.compose-comment.outputs.marker }}
-
- triage:
+ conflicts:
name: Merge conflict labeling
runs-on: ubuntu-latest
if: ${{ github.repository == 'jellyfin/jellyfin-web' }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 08a1ea8d56..237159e4e0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,7 +7,7 @@ concurrency:
on:
push:
branches: [ master, release* ]
- pull_request:
+ pull_request_target:
branches: [ master, release* ]
workflow_dispatch:
@@ -19,6 +19,8 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ with:
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup node environment
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
@@ -44,5 +46,83 @@ jobs:
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: jellyfin-web__prod
- path: |
- dist
+ path: dist
+
+ publish:
+ name: Deploy to Cloudflare Pages
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'jellyfin/jellyfin-web' }}
+ needs:
+ - run-build-prod
+ permissions:
+ contents: read
+ deployments: write
+
+ steps:
+ - name: Add comment
+ uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
+ if: ${{ github.event_name == 'pull_request_target' }}
+ with:
+ GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
+ message: |
+ ## Cloudflare Pages deployment
+
+ | **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }}
|
+ |-------------------|:-:|
+ | **Status** | 🔄 Deploying... |
+ | **Preview URL** | Not available |
+ | **Type** | 🔀 Preview |
+ pr_number: ${{ github.event.pull_request.number }}
+ comment_tag: CFPages-deployment
+ mode: recreate
+
+ - name: Download workflow artifact
+ uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
+ with:
+ name: jellyfin-web__prod
+ path: dist
+
+ - name: Publish to Cloudflare
+ id: cf
+ uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # v1.5.0
+ with:
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ projectName: jellyfin-web
+ branch: ${{ github.event.pull_request.head.ref || github.ref_name }}
+ directory: dist
+ gitHubToken: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Update status comment (Success)
+ if: ${{ github.event_name == 'pull_request_target' && success() }}
+ uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
+ with:
+ GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
+ message: |
+ ## Cloudflare Pages deployment
+
+ | **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }}
|
+ |-------------------|:-:|
+ | **Status** | ✅ Deployed! |
+ | **Preview URL** | ${{ steps.cf.outputs.url != '' && steps.cf.outputs.url || 'Not available' }} |
+ | **Type** | 🔀 Preview |
+ pr_number: ${{ github.event.pull_request.number }}
+ comment_tag: CFPages-deployment
+ mode: recreate
+
+ - name: Update status comment (Failure)
+ if: ${{ github.event_name == 'pull_request_target' && failure() }}
+ uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
+ with:
+ GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
+ message: |
+ ## Cloudflare Pages deployment
+
+ | **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }}
|
+ |-------------------|:-:|
+ | **Status** | ❌ Failure. Check workflow logs for details |
+ | **Preview URL** | Not available |
+ | **Type** | 🔀 Preview |
+ pr_number: ${{ github.event.pull_request.number }}
+ comment_tag: CFPages-deployment
+ mode: recreate
diff --git a/.github/workflows/job-messages.yml b/.github/workflows/job-messages.yml
deleted file mode 100644
index 7a58ecce76..0000000000
--- a/.github/workflows/job-messages.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-name: Job messages
-
-on:
- workflow_call:
- inputs:
- branch:
- required: false
- type: string
- commit:
- required: true
- type: string
- preview_url:
- required: false
- type: string
- build_workflow_run_id:
- required: false
- type: number
- commenting_workflow_run_id:
- required: true
- type: string
- in_progress:
- required: true
- type: boolean
- outputs:
- msg:
- description: The composed message
- value: ${{ jobs.msg.outputs.msg }}
- marker:
- description: Hidden marker to detect PR comments composed by the bot
- value: "CFPages-deployment"
-
-jobs:
- msg:
- name: Deployment status
- runs-on: ubuntu-latest
- outputs:
- msg: ${{ env.msg }}
-
- steps:
- - name: Compose message
- if: ${{ always() }}
- id: compose
- env:
- COMMIT: ${{ inputs.commit }}
- PREVIEW_URL: ${{ inputs.preview_url != '' && (inputs.branch != 'master' && inputs.preview_url || format('https://jellyfin-web.pages.dev ({0})', inputs.preview_url)) || 'Not available' }}
- DEPLOY_STATUS: ${{ inputs.in_progress && '🔄 Deploying...' || (inputs.preview_url != '' && '✅ Deployed!' || '❌ Failure. Check workflow logs for details') }}
- DEPLOYMENT_TYPE: ${{ inputs.branch != 'master' && '🔀 Preview' || '⚙️ Production' }}
- BUILD_WORKFLOW_RUN: ${{ !inputs.in_progress && format('**[View build logs](https://github.com/{0}/actions/runs/{1})**', 'jellyfin/jellyfin-web', inputs.build_workflow_run_id) || '' }}
- COMMENTING_WORKFLOW_RUN: ${{ format('**[View bot logs](https://github.com/{0}/actions/runs/{1})**', 'jellyfin/jellyfin-web', inputs.commenting_workflow_run_id) }}
- # EOF is needed for multiline environment variables in a GitHub Actions context
- run: |
- echo "## Cloudflare Pages deployment" > $GITHUB_STEP_SUMMARY
- echo "" >> $GITHUB_STEP_SUMMARY
- echo "| **Latest commit** | ${COMMIT::7}
|" >> $GITHUB_STEP_SUMMARY
- echo "|------------------------- |:----------------------------: |" >> $GITHUB_STEP_SUMMARY
- echo "| **Status** | $DEPLOY_STATUS |" >> $GITHUB_STEP_SUMMARY
- echo "| **Preview URL** | $PREVIEW_URL |" >> $GITHUB_STEP_SUMMARY
- echo "| **Type** | $DEPLOYMENT_TYPE |" >> $GITHUB_STEP_SUMMARY
- echo "" >> $GITHUB_STEP_SUMMARY
- echo "$BUILD_WORKFLOW_RUN" >> $GITHUB_STEP_SUMMARY
- echo "$COMMENTING_WORKFLOW_RUN" >> $GITHUB_STEP_SUMMARY
- COMPOSED_MSG=$(cat $GITHUB_STEP_SUMMARY)
- echo "msg<> $GITHUB_ENV
- echo "$COMPOSED_MSG" >> $GITHUB_ENV
- echo "EOF" >> $GITHUB_ENV
diff --git a/.github/workflows/pr-suggestions.yml b/.github/workflows/pr-suggestions.yml
index 78c3ef1610..bf841b11f2 100644
--- a/.github/workflows/pr-suggestions.yml
+++ b/.github/workflows/pr-suggestions.yml
@@ -7,8 +7,6 @@ concurrency:
on:
pull_request_target:
branches: [ master, release* ]
- types:
- - synchronize
jobs:
run-eslint:
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
deleted file mode 100644
index 5c60a94833..0000000000
--- a/.github/workflows/publish.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-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)
- }}
- EVENT: ${{ github.event.workflow_run.event }}
- PR_NUMBER: |
- ${{
- github.event.workflow_run.event == 'pull_request'
- && github.event.workflow_run.pull_requests[0] != null
- && github.event.workflow_run.pull_requests[0].number
- || ''
- }}
- outputs:
- url: ${{ steps.cf.outputs.url }}
- branch: ${{ env.TARGET_BRANCH }}
- pr_number: ${{ env.PR_NUMBER }}
-
- 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() &&
- needs.publish.outputs.pr_number != ''
- runs-on: ubuntu-latest
- needs:
- - compose-comment
- - publish
-
- 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: ${{ needs.publish.outputs.pr_number }}
- comment_tag: ${{ needs.compose-comment.outputs.marker }}
- mode: recreate