diff --git a/.github/workflows/build.yaml b/.gitea/workflows/build.yaml similarity index 60% rename from .github/workflows/build.yaml rename to .gitea/workflows/build.yaml index f3ff2a4..0abcf17 100644 --- a/.github/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -6,20 +6,15 @@ on: pull_request: workflow_dispatch: -permissions: - contents: read - concurrency: - group: build-${{ github.ref }} + group: build-${{ gitea.ref }} cancel-in-progress: false jobs: build: runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.version }} - tag: ${{ steps.version.outputs.tag }} - release: ${{ steps.version.outputs.release }} + permissions: + contents: write steps: - uses: actions/checkout@v4 @@ -79,49 +74,52 @@ jobs: - name: Update repository manifest if: steps.version.outputs.release == 'true' env: - GH_TOKEN: ${{ github.token }} + TOKEN: ${{ secrets.GITEA_TOKEN }} TAG: ${{ steps.version.outputs.tag }} run: | + api="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY" mkdir -p repo - if ! gh release download --repo "$GITHUB_REPOSITORY" --pattern manifest.json --dir repo 2>/dev/null; then + previous="$(curl -fsS -H "Authorization: token $TOKEN" "$api/releases/latest" 2>/dev/null \ + | python3 -c 'import json,sys; print(next((a["browser_download_url"] for a in json.load(sys.stdin).get("assets", []) if a["name"] == "manifest.json"), ""))' 2>/dev/null || true)" + if [ -n "$previous" ] && curl -fsSL -H "Authorization: token $TOKEN" -o repo/manifest.json "$previous"; then + echo "Continuing the manifest of the latest release" + else + rm -f repo/manifest.json jprm repo init repo fi + zip="$(ls artifacts/*.zip)" jprm repo add \ - --plugin-url "https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/$(basename "$zip")" \ + --plugin-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/$TAG/$(basename "$zip")" \ repo "$zip" cp repo/manifest.json artifacts/manifest.json cat artifacts/manifest.json - - uses: actions/upload-artifact@v4 - with: - name: plugin - path: | - artifacts/*.zip - artifacts/manifest.json - if-no-files-found: error - - release: - if: needs.build.outputs.release == 'true' - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: plugin - path: artifacts - - name: Create tag and release + if: steps.version.outputs.release == 'true' env: - GH_TOKEN: ${{ github.token }} - TAG: ${{ needs.build.outputs.tag }} + TOKEN: ${{ secrets.GITEA_TOKEN }} + TAG: ${{ steps.version.outputs.tag }} run: | + api="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY" sed -n '/^changelog:/,$p' build.yaml | sed '1d; s/^ //' > notes.md - gh release create "$TAG" artifacts/*.zip artifacts/manifest.json \ - --target "$GITHUB_SHA" \ - --title "Herald ${TAG#v}" \ - --notes-file notes.md + + python3 - > release.json <<'PY' + import json, os + tag = os.environ["TAG"] + print(json.dumps({ + "tag_name": tag, + "target_commitish": os.environ["GITHUB_SHA"], + "name": "Herald " + tag[1:], + "body": open("notes.md", encoding="utf-8").read(), + })) + PY + + id="$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ + --data @release.json "$api/releases" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')" + + for file in artifacts/*.zip artifacts/manifest.json; do + curl -fsS -X POST -H "Authorization: token $TOKEN" \ + -F "attachment=@$file" "$api/releases/$id/assets?name=$(basename "$file")" > /dev/null + echo "Attached $(basename "$file")" + done diff --git a/DECISIONS.md b/DECISIONS.md index 93a41d3..04f3835 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -6,7 +6,7 @@ One line per decision, with the reason. - Target Jellyfin **10.11.11** (`Jellyfin.Controller` / `Jellyfin.Model` 10.11.11, `net9.0`): it is the last 10.11 release on NuGet; the nuspec of that package lists `net9.0` as its only framework. Versions live in `Directory.Build.props`. - `targetAbi` is `10.11.0.0`: the plugin only uses APIs that exist across 10.11, so it should not be pinned to the patch release it was compiled against. -- Removed the template's `.github` workflows and Renovate preset: they call reusable workflows and secrets of the Jellyfin organisation and cannot run elsewhere. Replaced by one self-contained workflow. +- Removed the template's `.github` workflows and Renovate preset: they call reusable workflows and secrets of the Jellyfin organisation and cannot run elsewhere. Replaced by one self-contained workflow for Gitea Actions in `.gitea/workflows`; it talks to the Gitea API with `curl`, so it needs no forge-specific CLI on the runner. - Releases are driven by the version, not by hand-made tags: a push to `main` whose `build.yaml` version has no `v` tag is tagged and released by the workflow. The plugin repository manifest is a release asset carried forward from release to release, so nothing has to be committed back by CI. - Removed the template's `.vscode` folder: it assumes a local checkout of the Jellyfin server and web client next to the repo. - No analyzer warnings are suppressed project-wide. The only suppressions are three `CA2100` pragmas in `Storage/` where a command text is assigned from a constant string, which the analyzer cannot see through a helper. diff --git a/README.md b/README.md index 8c48e9a..772a41e 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ This writes `artifacts/herald_.zip`. The Jellyfin version, target frame The version lives in `build.yaml` (`version`) and `Directory.Build.props` (`Version`, `AssemblyVersion`, `FileVersion`); keep them equal, the workflow fails otherwise. Put the release notes in `changelog` in `build.yaml`. -Every push to `main` builds and tests. If the version has no `v` tag yet, the workflow also creates that tag and a GitHub release with two assets: the plugin zip and a `manifest.json` that lists this and all earlier releases. So a release is: bump the version, push. +Every push to `main` builds and tests. If the version has no `v` tag yet, the workflow (`.gitea/workflows/build.yaml`, Gitea Actions) also creates that tag and a release with two assets: the plugin zip and a `manifest.json` that lists this and all earlier releases. So a release is: bump the version, push. ## Hosting your own repository diff --git a/SUMMARY.md b/SUMMARY.md index c187a67..a177e7f 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -8,7 +8,7 @@ - **Client injection**: registered with the File Transformation plugin by reflection at startup; a warning is logged when that plugin is missing. Manual fallbacks are documented. - **Watch-time stats**: playback start/progress/stop events are turned into daily per-user aggregates; `GET /Herald/Stats` and a sortable "Stats" tab show them; a daily scheduled task drops rows older than 90 days. - **Storage**: one SQLite database in Jellyfin's data directory, using the `Microsoft.Data.Sqlite` that the server ships. Versioned migrations, serialized writes. -- **Project plumbing**: xUnit test project (56 tests), `build.yaml` for jprm, a GitHub Actions workflow (build, test, package; tags and releases automatically when the version changes), a sample `manifest.json`, `README.md`, `DECISIONS.md`. +- **Project plumbing**: xUnit test project (56 tests), `build.yaml` for jprm, a Gitea Actions workflow (build, test, package; tags and releases automatically when the version changes), a sample `manifest.json`, `README.md`, `DECISIONS.md`. ## What was verified, and how diff --git a/manifest.json b/manifest.json index a53ee4f..7e4a1aa 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,7 @@ "version": "1.0.0.0", "changelog": "Initial release: notices with acknowledgement tracking, watch-time stats.\n", "targetAbi": "10.11.0.0", - "sourceUrl": "https://github.com/JoshiCodes/jellyfin-Herald/releases/download/v1.0.0/herald_1.0.0.0.zip", + "sourceUrl": "https://git.joshicodes.de/JoshiCodes/jellyfin-herald/releases/download/v1.0.0.0/herald_1.0.0.0.zip", "checksum": "00000000000000000000000000000000", "timestamp": "2026-11-13T00:00:00Z" }