diff --git a/.github/workflows/__build.yml b/.github/workflows/__build.yml
deleted file mode 100644
index f0c0e676..00000000
--- a/.github/workflows/__build.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: Build
-
-on:
- workflow_call:
- inputs:
- ref:
- required: true
- type: string
- upload-pages-artifact:
- required: false
- type: boolean
- default: false
-
-jobs:
- build:
- name: Build
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- ref: ${{ inputs.ref }}
- - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- with:
- node-version: 20
- - name: Configure Pages
- if: inputs.upload-pages-artifact
- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- - name: Run build
- run: |
- npm ci --no-audit
- npm run build
- - name: Upload artifact
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
- with:
- name: jellyfin-org__build
- path: build
- # Manual artifact creation because upload-pages-artifact v4 excludes dotfiles
- # https://github.com/actions/upload-pages-artifact/issues/129
- - name: Create pages artifact
- if: inputs.upload-pages-artifact
- run: tar --dereference --hard-dereference --directory build -cvf "$RUNNER_TEMP/artifact.tar" --exclude=.git --exclude=.github .
- - name: Upload pages artifact
- if: inputs.upload-pages-artifact
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
- with:
- name: github-pages
- path: ${{ runner.temp }}/artifact.tar
- retention-days: 1
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6d8b62f7..2223afcf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: build
+name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -11,96 +11,23 @@ on:
jobs:
build:
- uses: ./.github/workflows/__build.yml
- permissions: {}
- with:
- ref: ${{ github.event.pull_request.head.sha || github.sha }}
- upload-pages-artifact: ${{ github.event_name == 'push' && github.repository == 'jellyfin/jellyfin.org' }}
-
- deploy:
- if: github.event_name == 'push' && github.repository == 'jellyfin/jellyfin.org'
- name: Deploy to GitHub Pages
+ name: Build
+ runs-on: ubuntu-latest
permissions:
- pages: write
- id-token: write
- concurrency: build-deploy-pages
- environment:
- name: github-pages
- url: ${{ steps.deployment.outputs.page_url }}
- runs-on: ubuntu-latest
- needs: build
+ contents: read
steps:
- - name: Deploy to GitHub Pages
- id: deployment
- uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
-
- publish:
- if: github.event_name != 'push' && github.repository == 'jellyfin/jellyfin.org'
- name: Deploy to Cloudflare Pages
- runs-on: ubuntu-latest
- needs: build
- steps:
- - name: Add comment
- uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
- if: github.event_name == 'pull_request'
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
+ - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
+ with:
+ node-version: 20
+ - name: Run build
+ run: |
+ npm ci --no-audit
+ npm run build
+ - name: Upload artifact
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: jellyfin-org__build
path: 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_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
- && (github.event.pull_request.head.ref || github.ref_name)
- || format('{0}/{1}', github.event.pull_request.head.repo.full_name, github.event.pull_request.head.ref)
- }} --commit-hash=${{ github.event.pull_request.head.sha || github.sha }}
- - name: Update status comment (Success)
- if: ${{ github.event_name == 'pull_request' && success() }}
- uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
- 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.deployment-url != '' && steps.cf.outputs.deployment-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' && failure() }}
- uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
- 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