From 1877dda671dfdf279de29fd5ff699a758fc99e70 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Wed, 2 Dec 2026 21:49:53 +1100 Subject: [PATCH] Replace upstream GitHub workflows with IUCLabs CI and release --- .github/CODEOWNERS | 1 + .github/actionlint.yaml | 2 + .github/workflows/build.yml | 39 ------------- .github/workflows/ci.yml | 45 +++++++++++++++ .github/workflows/dotnet.yml | 25 --------- .github/workflows/prettier.yml | 23 -------- .github/workflows/publish-nightly.yml | 71 ----------------------- .github/workflows/publish.yml | 53 ------------------ .github/workflows/release.yml | 65 +++++++++++++++++++++ .github/zizmor.yml | 7 +++ .pre-commit-config.yaml | 10 ++++ .woodpecker/release.yaml | 81 --------------------------- Makefile | 2 +- README.md | 12 ++-- SSO-Auth/Config/config.js | 6 +- SSO-Auth/Views/emby-restyle.css | 2 +- SSO-Auth/WebResponse.cs | 2 +- build.yaml | 2 +- 18 files changed, 141 insertions(+), 307 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/actionlint.yaml delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/dotnet.yml delete mode 100644 .github/workflows/prettier.yml delete mode 100644 .github/workflows/publish-nightly.yml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/zizmor.yml create mode 100644 .pre-commit-config.yaml delete mode 100644 .woodpecker/release.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..711107c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @IUCLabs/maintainers diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 0000000..267eecd --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,2 @@ +self-hosted-runner: + labels: [iuclabs-k8s, iuclabs-release] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 1d00d60..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,39 +0,0 @@ -on: - workflow_call: - inputs: - dotnet-version: - required: false - default: "9.0.x" - description: "The .NET version to setup for the build" - type: string - dotnet-target: - required: false - default: "net9.0" - description: "The .NET target to set for JPRM" - type: string - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "${{ inputs.dotnet-version }}" - - - name: Build Jellyfin Plugin - uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1 - id: jprm - with: - dotnet-target: "${{ inputs.dotnet-target }}" - - - name: Upload Artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # tag=v4.6.2 - with: - name: build-artifact - retention-days: 30 - if-no-files-found: error - path: ${{ steps.jprm.outputs.artifact }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..38d7d3f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: ci + +on: + pull_request: + push: + branches: [main] + +permissions: {} + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + ci: + uses: IUCLabs/workflows/.github/workflows/pre-commit.yml@v0.1.1 + permissions: + contents: read + with: + runs_on: iuclabs-k8s + + actions: + uses: IUCLabs/workflows/.github/workflows/actions.yml@v0.1.1 + permissions: + contents: read + with: + runs_on: ubuntu-latest + + dotnet: + runs-on: iuclabs-k8s + permissions: + contents: read + env: + DOTNET_CLI_TELEMETRY_OPTOUT: "1" + DOTNET_NOLOGO: "1" + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 + with: + dotnet-version: 10.0.x + - run: dotnet restore SSO-Auth.sln + - run: dotnet build SSO-Auth.sln -c Release --no-restore --warnaserror + - run: dotnet test SSO-Auth.sln -c Release --no-build --verbosity minimal diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml deleted file mode 100644 index f5b7d61..0000000 --- a/.github/workflows/dotnet.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: .NET - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 9.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore --warnaserror - - name: Test - run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml deleted file mode 100644 index 0c7eb04..0000000 --- a/.github/workflows/prettier.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Prettier Lint - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - - -jobs: - prettier: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - - name: Prettify code - uses: creyD/prettier_action@v4.3 - with: - dry: True - prettier_options: '--check **/*.{js,html,md,css,scss}' diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml deleted file mode 100644 index 8e29eb9..0000000 --- a/.github/workflows/publish-nightly.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Publish Nightly - -on: - push: - branches: [ main ] - workflow_dispatch: - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 9.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build Dotnet - run: dotnet build --no-restore --warnaserror - - name: "Flag as nightly in build.yaml" - uses: fjogeleit/yaml-update-action@v0.10.0 - with: - valueFile: 'build.yaml' - propertyPath: 'version' - value: "0.0.0.9000" - commitChange: false - updateFile: true - - name: "JPRM: Build" - id: jrpm - uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1 - with: - version: "0.0.0.9000" - verbosity: debug - path: . - dotnet-target: "net9.0" - output: _dist - - name: Prepare GitHub Release assets - run: |- - pushd _dist - for file in ./*.zip; do - md5sum ${file#./} >> ${file%.*}.md5 - sha256sum ${file#./} >> ${file%.*}.sha256 - done - ls -l - popd - - name: Publish output artifacts - id: publish-assets - uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa - with: - prerelease: false - fail_on_unmatched_files: true - tag_name: nightly - files: | - _dist/* - build.yaml - body: | - Nightly build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish Plugin Manifest - uses: Kevinjil/jellyfin-plugin-repo-action@a7832ecc44c6b1a45d531970f6647b8682b005b8 - with: - ignorePrereleases: true - githubToken: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }} - pagesBranch: manifest-release - pagesFile: manifest.json - diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index ac361d6..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Publish Release - -on: - release: - types: - - released - workflow_dispatch: - -jobs: - build: - uses: ./.github/workflows/build.yml - with: - dotnet-version: "9.0.*" - dotnet-target: "net9.0" - upload: - runs-on: ubuntu-latest - needs: - - build - steps: - - name: Download Artifact - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - with: - name: build-artifact - - name: Prepare GitHub Release assets - run: |- - for file in ./*; do - md5sum ${file#./} >> ${file%.*}.md5 - sha256sum ${file#./} >> ${file%.*}.sha256 - done - ls -l - - name: Publish output artifacts - id: publish-assets - uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa - with: - prerelease: false - fail_on_unmatched_files: true - tag_name: ${{ github.event.release.tag_name }} - files: ./* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - generate: - runs-on: ubuntu-latest - needs: - - upload - steps: - - name: Publish Plugin Manifest - uses: Kevinjil/jellyfin-plugin-repo-action@a7832ecc44c6b1a45d531970f6647b8682b005b8 - with: - ignorePrereleases: true - githubToken: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }} - pagesBranch: manifest-release - pagesFile: manifest.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a6b7bf9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: release + +on: + push: + tags: ["v[0-9]*"] + +permissions: {} + +jobs: + release: + runs-on: iuclabs-release + permissions: + contents: read + id-token: write + env: + VAULT_ADDR: https://vault.service.consul:8200 + ARTIFACTAPI: https://artifactapi.k8s.syd1.au.unkin.net + DOTNET_CLI_TELEMETRY_OPTOUT: "1" + DOTNET_NOLOGO: "1" + TAG: ${{ github.ref_name }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 + with: + dotnet-version: 10.0.x + - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 + - name: build plugin + run: | + set -euo pipefail + version=$(sed -n 's/^version: *"\([0-9.]*\)".*/\1/p' build.yaml | head -1) + if [ "v${version}" != "${TAG}" ]; then + echo "::error::tag ${TAG} does not match build.yaml version ${version}; use make patch/minor/major/hotfix" + exit 1 + fi + mkdir -p dist + uvx --from jprm==1.1.0 jprm plugin build . --output ./dist --version "${version}" --dotnet-configuration Release --dotnet-framework net10.0 + sha256sum dist/*.zip + # login after the build: vault tokens live 15m + - uses: hashicorp/vault-action@892a26828f195e65540a40b4768ae4571f51ebfc # v4.0.0 + with: + url: ${{ env.VAULT_ADDR }} + method: jwt + path: jwt/github/iuclabs + role: release + jwtGithubAudience: ${{ env.VAULT_ADDR }} + secrets: | + identity/oidc/token/artifactapi-writer token | ARTIFACTAPI_TOKEN + # uploads are immutable (409 on overwrite) and artifactapi has no HEAD route; an existing object is a no-op re-run + - name: publish + run: | + set -euo pipefail + zips=(dist/sso-authentication_*.zip) + zip="${zips[0]}" + url="${ARTIFACTAPI}/api/v2/remotes/jellyfin-plugins/files/unkin/jellyfin-plugin-sso/${TAG#v}/$(basename "${zip}")" + code=$(curl -s --cacert /etc/vault-ca/ca.crt -o /dev/null -w '%{http_code}' "${url}" || true) + if [ "${code}" = 200 ]; then + echo "${url} already published; skipping" + exit 0 + fi + auth="${RUNNER_TEMP}/auth" + printf 'Authorization: Bearer %s\n' "${ARTIFACTAPI_TOKEN}" > "${auth}" + curl -fsS --cacert /etc/vault-ca/ca.crt -X PUT "${url}" \ + -H "Content-Type: application/zip" -H @"${auth}" --data-binary @"${zip}" diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 0000000..21475c9 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,7 @@ +rules: + unpinned-uses: + config: + policies: + # shared workflows are pinned to their release tags + "IUCLabs/*": ref-pin + "*": hash-pin diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6e9cc2d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +exclude: \.min\.js$ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-merge-conflict diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml deleted file mode 100644 index 3b47c83..0000000 --- a/.woodpecker/release.yaml +++ /dev/null @@ -1,81 +0,0 @@ -when: - - event: tag - ref: refs/tags/v* - -steps: - # Everything runs on almalinux9-base: JPRM installs from the artifactapi pypi - # remote and the publish below PUTs to artifactapi, both over https against - # the internal CA. The Microsoft SDK image does not trust that CA (curl 60), - # so the dotnet build has to come to the image that does rather than the - # other way round. - - name: package - image: git.unkin.net/unkin/almalinux9-base:20260606 - environment: - DOTNET_CLI_TELEMETRY_OPTOUT: "1" - DOTNET_NOLOGO: "1" - commands: - - | - set -eu - VERSION=$$(sed -n 's/^version: *"\([0-9.]*\)".*/\1/p' build.yaml | head -1) - if [ "v$$VERSION" != "$$CI_COMMIT_TAG" ]; then - echo "tag $$CI_COMMIT_TAG does not match build.yaml version $$VERSION; use make patch/minor/major/hotfix" - exit 1 - fi - dnf -y -q install dotnet-sdk-10.0 python3-pip zip - pip3 install --quiet --index-url https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/pypi/simple "jprm==1.1.0" - mkdir -p dist - jprm plugin build . --output ./dist --version "$$VERSION" --dotnet-configuration Release --dotnet-framework net10.0 - ls -l dist - backend_options: - kubernetes: - serviceAccountName: jellyfin-plugin-sso - resources: - requests: - memory: 2Gi - cpu: 1 - limits: - memory: 4Gi - cpu: 2 - - # Uploads are immutable (409 on overwrite) and artifactapi has no HEAD route, - # so probe with GET and treat an existing object as a no-op re-run. - - name: publish - image: git.unkin.net/unkin/almalinux9-base:20260606 - commands: - - | - set -eu - HOST="https://artifactapi.k8s.syd1.au.unkin.net" - REPO="jellyfin-plugins" - ZIP=$$(ls dist/sso-authentication_*.zip | head -1) - VERSION=$$(echo "$$CI_COMMIT_TAG" | sed 's/^v//') - PATH_IN_REPO="unkin/jellyfin-plugin-sso/$$VERSION/$$(basename "$$ZIP")" - code=$$(curl -s -o /dev/null -w '%{http_code}' "$$HOST/api/v2/remotes/$$REPO/files/$$PATH_IN_REPO" || true) - if [ "$$code" = "200" ]; then - echo "$$PATH_IN_REPO already published (HTTP $$code); skipping upload" - exit 0 - fi - set -o pipefail - VAULT="https://vault.service.consul:8200" - AUTH=$$(mktemp) - VT=$$(jq -n --rawfile jwt /var/run/secrets/kubernetes.io/serviceaccount/token '{role:"woodpecker_artifactapi_writer",jwt:$$jwt}' \ - | curl -sf -d @- "$$VAULT/v1/auth/k8s/au/syd1/login" | jq -er .auth.client_token) || exit 1 - printf 'X-Vault-Token: %s\n' "$$VT" | curl -sf -H @- "$$VAULT/v1/identity/oidc/token/artifactapi-writer" \ - | jq -er '"Authorization: Bearer " + .data.token' > "$$AUTH" || exit 1 - echo "Uploading $$ZIP to $$REPO/$$PATH_IN_REPO (existence probe returned $$code)" - curl -f -X PUT \ - "$$HOST/api/v2/remotes/$$REPO/files/$$PATH_IN_REPO" \ - -H "Content-Type: application/zip" -H @"$$AUTH" \ - --data-binary @"$$ZIP" - echo - sha256sum "$$ZIP" - depends_on: [package] - backend_options: - kubernetes: - serviceAccountName: jellyfin-plugin-sso - resources: - requests: - memory: 256Mi - cpu: 250m - limits: - memory: 1Gi - cpu: 1 diff --git a/Makefile b/Makefile index e979f0f..97076a9 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ clean: # Jellyfin plugin versions are 4-part (System.Version in the plugin manifest), # so build.yaml holds the version and the release tag must be exactly -# v; .woodpecker/release.yaml fails the build if they diverge. +# v; .github/workflows/release.yml fails the build if they diverge. _CUR := $(shell sed -n 's/^version: *"\([0-9.]*\)".*/\1/p' build.yaml | head -1) _A := $(or $(word 1,$(subst ., ,$(_CUR))),0) _B := $(or $(word 2,$(subst ., ,$(_CUR))),0) diff --git a/README.md b/README.md index 7644502..1682c38 100644 --- a/README.md +++ b/README.md @@ -298,14 +298,10 @@ Build the zipped plugin with `jprm --verbosity=debug plugin build .`. ### CI Releases -Anything merged to the main branch will be built and published by our CI system. - -Anything tagged/released as a formal Github release will also be built and published by our CI system. - -If you wish to use releases from your own fork, refer to -[Installing](#installing), however, you will need to change the url to the -manifest file, `https://raw.githubusercontent.com/9p4/jellyfin-plugin-sso/manifest-release/manifest.json` -so that it refers to your fork. +This fork is released from [IUCLabs/jellyfin-plugin-sso](https://github.com/IUCLabs/jellyfin-plugin-sso). +`make patch|minor|major|hotfix` bumps `build.yaml`, tags `v` and pushes; the +[release workflow](.github/workflows/release.yml) builds the plugin with JPRM and uploads the zip to the +artifactapi `jellyfin-plugins` repo under `unkin/jellyfin-plugin-sso//`. ## Credits and Thanks diff --git a/SSO-Auth/Config/config.js b/SSO-Auth/Config/config.js index a811ac0..01cfeff 100644 --- a/SSO-Auth/Config/config.js +++ b/SSO-Auth/Config/config.js @@ -89,7 +89,7 @@ const ssoConfigurationPage = { elem.classList.add("sso-role-mapping-container"); elem.innerHTML = `
- -
+ +
diff --git a/SSO-Auth/Views/emby-restyle.css b/SSO-Auth/Views/emby-restyle.css index 02343e3..d681fe9 100644 --- a/SSO-Auth/Views/emby-restyle.css +++ b/SSO-Auth/Views/emby-restyle.css @@ -45,7 +45,7 @@ theme.css pointer-events: none; } -/* +/* Emby Button */ diff --git a/SSO-Auth/WebResponse.cs b/SSO-Auth/WebResponse.cs index ac93907..cca65e1 100644 --- a/SSO-Auth/WebResponse.cs +++ b/SSO-Auth/WebResponse.cs @@ -445,7 +445,7 @@ async function link(request) { xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader( - 'X-Emby-Authorization', + 'X-Emby-Authorization', `MediaBrowser Client=""${request.appName}"",Device=""${request.deviceName}"",DeviceId=""${request.deviceId}"",Version=""${request.appVersion}"",Token=""${jfToken}""`) xhr.onload = function(e) { diff --git a/build.yaml b/build.yaml index 927a1fc..e06c4d8 100644 --- a/build.yaml +++ b/build.yaml @@ -24,7 +24,7 @@ changelog: | 3.5.2.2: Fix linking page when using new paths 3.5.2.1: Hotfix for SAML null checks 3.5.2.0: Allow overriding the scheme used for generating URLs. - 3.5.1.1: Change iframe URL to point to the web UI instead of the root + 3.5.1.1: Change iframe URL to point to the web UI instead of the root 3.5.1.0: Improved paths! No more obscure "p" versus "r" URLs! Improve final redirect for automatic authentication. Add more configuration options for OpenID discovery. 3.5.0.0: Add support for Live TV authentication. Fix various null pointer bugs. 3.4.0.0: Add user self-service for linking existing accounts + managing existing links. Allow IDP accounts to be linked to jellyfin accounts with a different display-name. -- 2.47.3