jellyfin-web/.github/workflows/build.yml

73 lines
2.0 KiB
YAML
Raw Normal View History

2023-09-27 23:22:58 -07:00
name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches: [ master, release* ]
pull_request:
branches: [ master, release* ]
2023-09-27 23:22:58 -07:00
workflow_dispatch:
jobs:
2023-09-27 23:22:58 -07:00
run-build-prod:
name: Run production build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
2023-11-09 13:07:33 -07:00
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup node environment
2024-02-07 06:52:39 -07:00
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
check-latest: true
cache: npm
- name: Install Node.js dependencies
run: npm ci --no-audit
2023-09-27 23:22:58 -07:00
- name: Run a production build
env:
2024-02-27 13:47:56 -07:00
JELLYFIN_VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
2023-09-27 23:22:58 -07:00
run: npm run build:production
- name: Update config.json for testing
run: |
jq '.multiserver=true | .servers=["https://demo.jellyfin.org/unstable"]' dist/config.json > dist/config.tmp.json
mv dist/config.tmp.json dist/config.json
2023-09-27 23:22:58 -07:00
- name: Upload artifact
2024-02-07 06:52:39 -07:00
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
2023-09-27 23:22:58 -07:00
with:
name: jellyfin-web__prod
path: |
dist
2023-10-09 21:39:31 -07:00
pr_context:
name: Save PR context as artifact
if: ${{ always() && !cancelled() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs:
- run-build-prod
steps:
- name: Save PR context
env:
PR_NUMBER: ${{ github.event.number }}
2024-02-27 13:47:56 -07:00
PR_SHA: ${{ github.event.pull_request.head.sha }}
2023-10-09 21:39:31 -07:00
run: |
echo $PR_NUMBER > PR_number
echo $PR_SHA > PR_sha
- name: Upload PR number as artifact
2024-02-07 06:52:39 -07:00
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
2023-10-09 21:39:31 -07:00
with:
name: PR_context
path: |
PR_number
PR_sha