Prepare for GitHub migration #6

Open
unkin-agent wants to merge 1 commits from benvin/github-migration into main
18 changed files with 141 additions and 307 deletions
+1
View File
@@ -0,0 +1 @@
* @IUCLabs/maintainers
+2
View File
@@ -0,0 +1,2 @@
self-hosted-runner:
labels: [iuclabs-k8s, iuclabs-release]
-39
View File
@@ -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 }}
+45
View File
@@ -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
-25
View File
@@ -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
-23
View File
@@ -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}'
-71
View File
@@ -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
-53
View File
@@ -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
+65
View File
@@ -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}"
+7
View File
@@ -0,0 +1,7 @@
rules:
unpinned-uses:
config:
policies:
# shared workflows are pinned to their release tags
"IUCLabs/*": ref-pin
"*": hash-pin
+10
View File
@@ -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
-81
View File
@@ -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
+1 -1
View File
@@ -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<that version>; .woodpecker/release.yaml fails the build if they diverge.
# v<that version>; .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)
+4 -8
View File
@@ -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<version>` 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/<version>/`.
## Credits and Thanks
+3 -3
View File
@@ -89,7 +89,7 @@ const ssoConfigurationPage = {
elem.classList.add("sso-role-mapping-container");
elem.innerHTML = `
<label
class="inputLabel inputLabelUnfocused sso-role-mapping-input-label"
class="inputLabel inputLabelUnfocused sso-role-mapping-input-label"
>Role:</label>
<div class="listItem">
<input
@@ -104,8 +104,8 @@ const ssoConfigurationPage = {
class="listItemButton sso-remove-role-mapping"
>
<span class="material-icons remove_circle" aria-hidden="true"></span>
</button>
</div>
</button>
</div>
<div
class="checkboxList paperList sso-folder-list"
></div>
+1 -1
View File
@@ -45,7 +45,7 @@ theme.css
pointer-events: none;
}
/*
/*
Emby Button
*/
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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.