mirror of
https://github.com/jellyfin/jellyfin.org.git
synced 2026-09-03 05:30:05 +03:00
122 lines
4.6 KiB
YAML
122 lines
4.6 KiB
YAML
name: deploy
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
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:
|
|
actions: read
|
|
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
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
|
run: gh run download "$RUN_ID" -n jellyfin-org__build -D build
|
|
- name: Configure Pages
|
|
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
|
|
- name: Create pages artifact
|
|
run: tar --dereference --hard-dereference --directory build -cvf "$RUNNER_TEMP/artifact.tar" --exclude=.git --exclude=.github .
|
|
- name: Upload pages artifact
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: github-pages
|
|
path: ${{ runner.temp }}/artifact.tar
|
|
retention-days: 1
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
|
|
|
|
publish:
|
|
if: |
|
|
github.event.workflow_run.conclusion == 'success' &&
|
|
github.event.workflow_run.event == 'pull_request' &&
|
|
github.event.workflow_run.pull_requests &&
|
|
github.repository == 'jellyfin/jellyfin.org'
|
|
|
|
name: Deploy to Cloudflare Pages
|
|
permissions:
|
|
actions: read
|
|
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
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
|
run: gh run download "$RUN_ID" -n jellyfin-org__build -D build
|
|
- 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
|