name: Publish Release # NOTE: This repo lives on a private Gitea instance # (https://www.git.quarantinedstudio.com/mvezina/CinemaTrailers4Jellyfins), not GitHub. # Gitea Actions understands a compatible subset of GitHub Actions syntax, but: # - The runner here executes jobs in host mode (no Docker). act's host executor has # a known unfixed path-resolution bug for JavaScript-based actions (MODULE_NOT_FOUND # on dist/index.js — see nektos/act#2024), so actions/checkout and # actions/setup-dotnet are replaced below with plain git/shell equivalents. The # runner host already has git, dotnet (9.x), zip/unzip and python3+pyyaml installed. # - softprops/action-gh-release talks to the GitHub API and will NOT work against # Gitea — it has been replaced below with direct calls to the Gitea Releases API # via curl, which needs a GITEA_TOKEN secret. Note: GITEA_TOKEN is a *reserved* name # that Gitea auto-injects into every job (like GitHub's GITHUB_TOKEN) — you cannot # and do not need to create it yourself; its permissions come from the `permissions:` # block below. # Treat this file as a starting template: verify runner/action availability and the # release-API calls against your instance before relying on it. on: push: tags: - 'v*.*.*.*' permissions: contents: write jobs: release: runs-on: ubuntu-latest steps: - name: Checkout env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | set -e REPO_URL="${{ github.server_url }}/${{ github.repository }}.git" AUTH_HEADER="$(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 -w0)" git init -q . git remote add origin "$REPO_URL" git config http.extraheader "Authorization: Basic ${AUTH_HEADER}" git fetch -q origin "${{ github.ref }}" git checkout -q FETCH_HEAD git config user.name "gitea-actions" git config user.email "gitea-actions@quarantinedstudio.com" - name: Verify .NET 9 SDK run: dotnet --version - name: Get version from tag id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Build run: | dotnet publish \ Jellyfin.Plugin.CinemaTrailers4Jellyfins/Jellyfin.Plugin.CinemaTrailers4Jellyfins.csproj \ --configuration Release \ --output bin - name: Package run: | VERSION="${{ steps.version.outputs.VERSION }}" # Always include the plugin DLL itself, then all third-party dependencies. # Exclude Jellyfin/MediaBrowser framework DLLs — the server already has those loaded. DEPS=$(find bin -name "*.dll" \ | grep -Ev "/(Jellyfin\.|MediaBrowser\.|Microsoft\.|System\.|netstandard|mscorlib)" \ | tr '\n' ' ') zip -j "cinematrailers4jellyfins_${VERSION}.zip" \ bin/Jellyfin.Plugin.CinemaTrailers4Jellyfins.dll \ $DEPS - name: Checksum id: checksum run: | VERSION="${{ steps.version.outputs.VERSION }}" echo "MD5=$(md5sum cinematrailers4jellyfins_${VERSION}.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" - name: Update manifest.json run: | pip install pyyaml --quiet python3 update_manifest.py "${{ steps.version.outputs.VERSION }}" "${{ steps.checksum.outputs.MD5 }}" - name: Commit manifest run: | git config user.name "gitea-actions" git config user.email "gitea-actions@quarantinedstudio.com" git add manifest.json git commit -m "chore: update manifest.json for v${{ steps.version.outputs.VERSION }}" || echo "No changes to commit" git fetch origin main git rebase origin/main git push origin HEAD:main - name: Create Gitea release and upload asset env: GITEA_SERVER: https://www.git.quarantinedstudio.com GITEA_REPO: mvezina/CinemaTrailers4Jellyfins GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | VERSION="${{ steps.version.outputs.VERSION }}" TAG="${{ github.ref_name }}" ZIP="cinematrailers4jellyfins_${VERSION}.zip" BODY="See build.yaml for the changelog. To install, add ${GITEA_SERVER}/${GITEA_REPO}/raw/branch/main/manifest.json as a plugin repository in Jellyfin -> Admin -> Plugins -> Repositories." RELEASE_ID=$(curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\": \"${TAG}\", \"name\": \"Release ${TAG}\", \"body\": \"${BODY}\"}" \ "${GITEA_SERVER}/api/v1/repos/${GITEA_REPO}/releases" \ | python3 -c "import sys, json; print(json.load(sys.stdin)['id'])") curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -F "attachment=@${ZIP}" \ "${GITEA_SERVER}/api/v1/repos/${GITEA_REPO}/releases/${RELEASE_ID}/assets?name=${ZIP}"