mirror of
https://github.com/jellyfin/jellyfin.org.git
synced 2026-09-03 04:10:04 +03:00
separated deployment workflow
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
name: Deploy
|
||||
|
||||
concurrency:
|
||||
group: deploy-${{ github.event.workflow_run.head_sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['Build']
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: |
|
||||
github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.event == 'push' &&
|
||||
github.repository == 'jellyfin/jellyfin.org'
|
||||
|
||||
name: Deploy to GitHub Pages
|
||||
permissions:
|
||||
pages: write
|
||||
id-token: write
|
||||
concurrency: build-deploy-pages
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download workflow artifact
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
|
||||
with:
|
||||
name: jellyfin-org__build
|
||||
path: build
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
- name: Configure Pages
|
||||
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
|
||||
|
||||
publish:
|
||||
if: |
|
||||
github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.event == 'pull_request' &&
|
||||
github.repository == 'jellyfin/jellyfin.org'
|
||||
|
||||
name: Deploy to Cloudflare Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set PR metadata
|
||||
id: pr
|
||||
run: |
|
||||
echo "number=${{ github.event.workflow_run.pull_requests[0].number }}" >> $GITHUB_OUTPUT
|
||||
echo "sha=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT
|
||||
- name: Add comment
|
||||
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
|
||||
with:
|
||||
github-token: ${{ secrets.JF_BOT_TOKEN }}
|
||||
message: |
|
||||
## Cloudflare Pages deployment
|
||||
|
||||
| **Latest commit** | <code>${{ steps.pr.outputs.sha }}</code> |
|
||||
|-------------------|:-:|
|
||||
| **Status** | 🔄 Deploying... |
|
||||
| **Preview URL** | Not available |
|
||||
| **Type** | 🔀 Preview |
|
||||
pr-number: ${{ steps.pr.outputs.number }}
|
||||
comment-tag: CFPages-deployment
|
||||
mode: recreate
|
||||
- name: Download workflow artifact
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
|
||||
with:
|
||||
name: jellyfin-org__build
|
||||
path: build
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
- name: Publish to Cloudflare
|
||||
id: cf
|
||||
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: >
|
||||
pages deploy build
|
||||
--project-name=jellyfin-org
|
||||
--branch=${{ (github.event.workflow_run.event != 'pull_request'
|
||||
|| 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)
|
||||
}}
|
||||
--commit-hash=${{ steps.pr.outputs.sha }}
|
||||
- name: Update status comment
|
||||
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
|
||||
with:
|
||||
github-token: ${{ secrets.JF_BOT_TOKEN }}
|
||||
message: |
|
||||
## Cloudflare Pages deployment
|
||||
|
||||
| **Latest commit** | <code>${{ steps.pr.outputs.sha }}</code> |
|
||||
|-------------------|:-:|
|
||||
| **Status** | ${{ job.status == 'success' && '✅ Deployed!' || '❌ Failed!' }} |
|
||||
| **Preview URL** | ${{ steps.cf.outputs.deployment-url || 'Not available' }} |
|
||||
| **Type** | 🔀 Preview |
|
||||
pr-number: ${{ steps.pr.outputs.number }}
|
||||
comment-tag: CFPages-deployment
|
||||
mode: recreate
|
||||
Reference in New Issue
Block a user