diff --git a/.github/workflows/automation.yml b/.github/workflows/__automation.yml similarity index 59% rename from .github/workflows/automation.yml rename to .github/workflows/__automation.yml index 0405a694e6..21e9f04ef7 100644 --- a/.github/workflows/automation.yml +++ b/.github/workflows/__automation.yml @@ -1,20 +1,12 @@ -name: Automation - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true +name: Automation ๐ŸŽ›๏ธ on: - push: - branches: - - master - pull_request_target: + workflow_call: jobs: conflicts: - name: Merge conflict labeling + name: Merge conflict labeling ๐Ÿท๏ธ runs-on: ubuntu-latest - if: ${{ github.repository == 'jellyfin/jellyfin-web' }} steps: - uses: eps1lon/actions-label-merge-conflict@1b1b1fcde06a9b3d089f3464c96417961dde1168 # v3.0.2 with: diff --git a/.github/workflows/__codeql.yml b/.github/workflows/__codeql.yml new file mode 100644 index 0000000000..320a5b4b81 --- /dev/null +++ b/.github/workflows/__codeql.yml @@ -0,0 +1,40 @@ +name: GitHub CodeQL ๐Ÿ”ฌ + +on: + workflow_call: + inputs: + commit: + required: true + type: string + +jobs: + analyze: + name: Analyze ${{ matrix.language }} ๐Ÿ”ฌ + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: + - javascript-typescript + + steps: + - name: Checkout repository โฌ‡๏ธ + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.commit }} + show-progress: false + + - name: Initialize CodeQL ๐Ÿ› ๏ธ + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + with: + queries: security-and-quality + languages: ${{ matrix.language }} + + - name: Autobuild ๐Ÿ“ฆ + uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + + - name: Perform CodeQL Analysis ๐Ÿงช + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + with: + category: '/language:${{matrix.language}}' diff --git a/.github/workflows/__deploy.yml b/.github/workflows/__deploy.yml new file mode 100644 index 0000000000..bcdd2bd875 --- /dev/null +++ b/.github/workflows/__deploy.yml @@ -0,0 +1,59 @@ +name: Deploy ๐Ÿ—๏ธ + +on: + workflow_call: + inputs: + branch: + required: true + type: string + commit: + required: false + type: string + comment: + required: false + type: boolean + artifact_name: + required: false + type: string + default: frontend + +jobs: + cf-pages: + name: CloudFlare Pages ๐Ÿ“ƒ + runs-on: ubuntu-latest + environment: + name: ${{ inputs.branch == 'master' && 'Production' || 'Preview' }} + url: ${{ steps.cf.outputs.deployment-url }} + outputs: + url: ${{ steps.cf.outputs.deployment-url }} + + steps: + - name: Download workflow artifact โฌ‡๏ธ + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: ${{ inputs.artifact_name }} + path: dist + + - name: Publish to Cloudflare Pages ๐Ÿ“ƒ + uses: cloudflare/wrangler-action@f84a562284fc78278ff9052435d9526f9c718361 # v3.7.0 + id: cf + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy dist --project-name=jellyfin-web --branch=${{ inputs.branch }} + + compose-comment: + name: Compose and push comment ๐Ÿ“ + # Always run so the comment is composed for the workflow summary + if: ${{ always() }} + uses: ./.github/workflows/__job_messages.yml + secrets: inherit + needs: + - cf-pages + + with: + branch: ${{ inputs.branch }} + commit: ${{ inputs.commit }} + preview_url: ${{ needs.cf-pages.outputs.url }} + in_progress: false + comment: ${{ inputs.comment }} diff --git a/.github/workflows/__job_messages.yml b/.github/workflows/__job_messages.yml new file mode 100644 index 0000000000..db39f1dca2 --- /dev/null +++ b/.github/workflows/__job_messages.yml @@ -0,0 +1,65 @@ +name: Job messages โš™๏ธ + +on: + workflow_call: + inputs: + branch: + required: false + type: string + commit: + required: true + type: string + preview_url: + required: false + type: string + in_progress: + required: true + type: boolean + comment: + required: false + type: boolean + marker: + description: Hidden marker to detect PR comments composed by the bot + required: false + type: string + default: "CFPages-deployment" + + +jobs: + cf_pages_msg: + name: CloudFlare Pages deployment ๐Ÿ“ƒ๐Ÿš€ + runs-on: ubuntu-latest + + 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' }} + WORKFLOW_RUN: ${{ !inputs.in_progress && format('**[View build logs](https://github.com/{0}/actions/runs/{1})**', github.repository, github.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 "$WORKFLOW_RUN" >> $GITHUB_STEP_SUMMARY + COMPOSED_MSG=$(cat $GITHUB_STEP_SUMMARY) + echo "msg<> $GITHUB_ENV + echo "$COMPOSED_MSG" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Push comment to Pull Request ๐Ÿ”ผ + uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0 + if: ${{ inputs.comment && steps.compose.conclusion == 'success' }} + with: + GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} + message: ${{ env.msg }} + comment_tag: ${{ inputs.marker }} diff --git a/.github/workflows/__package.yml b/.github/workflows/__package.yml new file mode 100644 index 0000000000..4b7e15d3bc --- /dev/null +++ b/.github/workflows/__package.yml @@ -0,0 +1,44 @@ +name: Packaging ๐Ÿ“ฆ + +on: + workflow_call: + inputs: + commit: + required: false + type: string + +jobs: + run-build-prod: + name: Run production build ๐Ÿ—๏ธ + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.commit || github.sha }} + + - name: Setup node environment + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 20 + check-latest: true + + - name: Install Node.js dependencies + run: npm ci --no-audit + + - name: Run a production build + env: + JELLYFIN_VERSION: ${{ inputs.commit || github.sha }} + 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 + + - name: Upload artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: frontend + path: dist diff --git a/.github/workflows/__quality_checks.yml b/.github/workflows/__quality_checks.yml new file mode 100644 index 0000000000..f89ecc8a56 --- /dev/null +++ b/.github/workflows/__quality_checks.yml @@ -0,0 +1,60 @@ +name: Quality checks ๐Ÿ‘Œ๐Ÿงช + +on: + workflow_call: + inputs: + commit: + required: true + type: string + workflow_dispatch: + +jobs: + dependency-review: + name: Vulnerable dependencies ๐Ÿ”Ž + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.commit }} + show-progress: false + + - name: Scan + uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 + with: + ## Workaround from https://github.com/actions/dependency-review-action/issues/456 + ## TODO: Remove when necessary + base-ref: ${{ github.event.pull_request.base.sha || 'master' }} + head-ref: ${{ github.event.pull_request.head.sha || github.ref }} + + quality: + name: Run ${{ matrix.command }} ๐Ÿ•ต๏ธโ€โ™‚๏ธ + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + command: + - build:es-check + - lint + - stylelint + - build:check + - test + + steps: + - name: Checkout โฌ‡๏ธ + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.commit }} + show-progress: false + + - name: Setup node environment โš™๏ธ + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 20 + check-latest: true + + - name: Install dependencies ๐Ÿ“ฆ + run: npm ci --no-audit + + - name: Run ${{ matrix.command }} โš™๏ธ + run: npm run ${{ matrix.command }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c1896f0397..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Build - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -on: - push: - branches: [ master, release* ] - pull_request_target: - branches: [ master, release* ] - workflow_dispatch: - -jobs: - run-build-prod: - name: Run production build - runs-on: ubuntu-latest - - 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 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run a production build - env: - JELLYFIN_VERSION: ${{ github.event.pull_request.head.sha || github.sha }} - 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 - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: jellyfin-web__prod - 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: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: jellyfin-web__prod - path: dist - - - name: Publish to Cloudflare - id: cf - uses: cloudflare/wrangler-action@f84a562284fc78278ff9052435d9526f9c718361 # v3.7.0 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=jellyfin-web --branch=${{ - (github.event_name != 'pull_request_target' || 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_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.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_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/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 7060ef9b9a..0000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CodeQL - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -on: - push: - branches: [ master, release* ] - pull_request: - branches: [ master, release* ] - schedule: - - cron: '30 7 * * 6' - -jobs: - codeql: - name: Run CodeQL - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 - with: - languages: javascript - queries: +security-extended - - - name: Autobuild - uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml deleted file mode 100644 index c4a95a6259..0000000000 --- a/.github/workflows/commands.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Commands -on: - issue_comment: - types: - - created - - edited - -jobs: - rebase: - name: Rebase - if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '@jellyfin-bot rebase') && github.event.comment.author_association == 'MEMBER' - runs-on: ubuntu-latest - steps: - - name: Notify as seen - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 - with: - token: ${{ secrets.JF_BOT_TOKEN }} - comment-id: ${{ github.event.comment.id }} - reactions: '+1' - - name: Checkout the latest code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - token: ${{ secrets.JF_BOT_TOKEN }} - fetch-depth: 0 - - name: Automatic Rebase - uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 # 1.8 - env: - GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} - - name: Comment on failure - if: failure() - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 - with: - token: ${{ secrets.JF_BOT_TOKEN }} - issue-number: ${{ github.event.issue.number }} - body: | - I'm sorry @${{ github.event.comment.user.login }}, I'm afraid I can't do that. diff --git a/.github/workflows/pr-suggestions.yml b/.github/workflows/pr-suggestions.yml deleted file mode 100644 index e57ab85eb6..0000000000 --- a/.github/workflows/pr-suggestions.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PR suggestions - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.id || github.run_id }} - cancel-in-progress: true - -on: - pull_request_target: - branches: [ master, release* ] - -jobs: - run-eslint: - name: Run eslint suggestions - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Setup node environment - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run eslint - if: ${{ github.repository == 'jellyfin/jellyfin-web' }} - uses: CatChen/eslint-suggestion-action@09aa3e557bafa4bebe3e026d8808bffff08e67a9 # v4.1.6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000000..de33fd0c42 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,99 @@ +name: Pull Request ๐Ÿ“ฅ + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +on: + pull_request_target: + branches: + - master + - release* + paths-ignore: + - '**/*.md' + merge_group: + +jobs: + push-comment: + name: Create comments โœ๏ธ + if: ${{ always() && !cancelled() && github.repository == 'jellyfin/jellyfin-web' }} + uses: ./.github/workflows/__job_messages.yml + secrets: inherit + with: + commit: ${{ github.event.pull_request.head.sha }} + in_progress: true + comment: true + + build: + name: Build ๐Ÿ—๏ธ + if: ${{ always() && !cancelled() }} + uses: ./.github/workflows/__package.yml + with: + commit: ${{ github.event.pull_request.head.sha }} + + automation: + name: Automation ๐ŸŽ›๏ธ + if: ${{ github.repository == 'jellyfin/jellyfin-web' }} + uses: ./.github/workflows/__automation.yml + secrets: inherit + + quality_checks: + name: Quality checks ๐Ÿ‘Œ๐Ÿงช + if: ${{ always() && !cancelled() }} + uses: ./.github/workflows/__quality_checks.yml + permissions: {} + with: + commit: ${{ github.event.pull_request.head.ref }} + + codeql: + name: GitHub CodeQL ๐Ÿ”ฌ + if: ${{ always() && !cancelled() }} + uses: ./.github/workflows/__codeql.yml + permissions: + actions: read + contents: read + security-events: write + with: + commit: ${{ github.event.pull_request.head.sha }} + + deploy: + name: Deploy ๐Ÿš€ + uses: ./.github/workflows/__deploy.yml + if: ${{ always() && !cancelled() && needs.build.result == 'success' && github.repository == 'jellyfin/jellyfin-web' }} + needs: + - push-comment + - build + permissions: + contents: read + deployments: write + secrets: inherit + with: + # If the PR is from the master branch of a fork, append the fork's name to the branch name + branch: ${{ github.event.pull_request.head.repo.full_name != github.repository && github.event.pull_request.head.ref == 'master' && format('{0}/{1}', github.event.pull_request.head.repo.full_name, github.event.pull_request.head.ref) || github.event.pull_request.head.ref }} + comment: true + commit: ${{ github.event.pull_request.head.sha }} + + run-eslint: + name: Run eslint suggestions + if: ${{ github.repository == 'jellyfin/jellyfin-web' }} + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Setup node environment + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 20 + check-latest: true + + - name: Install Node.js dependencies + run: npm ci --no-audit + + - name: Run eslint + uses: CatChen/eslint-suggestion-action@09aa3e557bafa4bebe3e026d8808bffff08e67a9 # v4.1.6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000000..93e3e09f1f --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,58 @@ +name: Push & Release ๐ŸŒ + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - master + - release* + paths-ignore: + - '**/*.md' + +jobs: + automation: + name: Automation ๐ŸŽ›๏ธ + if: ${{ github.repository == 'jellyfin/jellyfin-web' }} + uses: ./.github/workflows/__automation.yml + secrets: inherit + + main: + name: 'Unstable release ๐Ÿš€โš ๏ธ' + uses: ./.github/workflows/__package.yml + with: + commit: ${{ github.sha }} + + quality_checks: + name: Quality checks ๐Ÿ‘Œ๐Ÿงช + if: ${{ always() && !cancelled() }} + uses: ./.github/workflows/__quality_checks.yml + permissions: {} + with: + commit: ${{ github.sha }} + + codeql: + name: GitHub CodeQL ๐Ÿ”ฌ + uses: ./.github/workflows/__codeql.yml + permissions: + actions: read + contents: read + security-events: write + with: + commit: ${{ github.sha }} + + deploy: + name: Deploy ๐Ÿš€ + if: ${{ github.repository == 'jellyfin/jellyfin-web' }} + uses: ./.github/workflows/__deploy.yml + needs: + - main + permissions: + contents: read + deployments: write + secrets: inherit + with: + branch: ${{ github.ref_name }} + comment: diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml deleted file mode 100644 index f9861cec21..0000000000 --- a/.github/workflows/quality.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Quality checks - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -on: - push: - branches: [ master, release* ] - pull_request: - branches: [ master, release* ] - -jobs: - run-escheck: - name: Run es-check - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Setup node environment - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run a production build - run: npm run build:production - - - name: Run es-check - run: npm run escheck - - run-eslint: - name: Run eslint - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Setup node environment - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run eslint - run: npx eslint --quiet "." - - run-stylelint: - name: Run stylelint - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Setup node environment - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Set up stylelint matcher - uses: xt0rted/stylelint-problem-matcher@34db1b874c0452909f0696aedef70b723870a583 # tag=v1 - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run stylelint - run: npm run stylelint - - run-tsc: - name: Run TypeScript build check - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Setup node environment - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run tsc - run: npm run build:check - - run-test: - name: Run tests - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Setup node environment - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 20 - check-latest: true - cache: npm - - - name: Install Node.js dependencies - run: npm ci --no-audit - - - name: Run test suite - run: npm run test diff --git a/.github/workflows/stale.yml b/.github/workflows/schedule.yml similarity index 61% rename from .github/workflows/stale.yml rename to .github/workflows/schedule.yml index 2f3bca85e1..5c07f5a302 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/schedule.yml @@ -1,10 +1,10 @@ -name: Stale Check +name: Scheduled tasks ๐Ÿ•‘ on: schedule: - cron: '30 1 * * *' workflow_dispatch: - + permissions: issues: write pull-requests: write @@ -49,3 +49,45 @@ jobs: stale-pr-label: merge conflict close-pr-message: |- This PR has been closed due to having unresolved merge conflicts. + + update: + name: Update the Jellyfin SDK + runs-on: ubuntu-latest + if: ${{ github.repository == 'jellyfin/jellyfin-web' }} + + steps: + - name: Check out Git repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: master + token: ${{ secrets.JF_BOT_TOKEN }} + + - name: Set up Node.js + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 20 + check-latest: true + cache: npm + + - name: Install latest unstable SDK + run: | + npm i --save @jellyfin/sdk@unstable + VERSION=$(jq -r '.dependencies["@jellyfin/sdk"]' package.json) + echo "JF_SDK_VERSION=${VERSION}" >> $GITHUB_ENV + + - name: Open a pull request + uses: peter-evans/create-pull-request@8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20 # v7.0.1 + with: + token: ${{ secrets.JF_BOT_TOKEN }} + commit-message: Update @jellyfin/sdk to ${{env.JF_SDK_VERSION}} + committer: jellyfin-bot + author: jellyfin-bot + branch: update-jf-sdk + delete-branch: true + title: Update @jellyfin/sdk to ${{env.JF_SDK_VERSION}} + body: | + **Changes** + Updates to the latest unstable @jellyfin/sdk build + labels: | + dependencies + npm diff --git a/package.json b/package.json index d5650b7796..26d1c09d3b 100644 --- a/package.json +++ b/package.json @@ -152,6 +152,7 @@ "build:development": "webpack --config webpack.dev.js", "build:production": "cross-env NODE_ENV=\"production\" webpack --config webpack.prod.js", "build:check": "tsc --noEmit", + "build:es-check": "npm run build:production && npm run escheck", "escheck": "es-check", "lint": "eslint \"./\"", "test": "vitest --watch=false --config vite.config.ts",