name: Release Plugin on: push: tags: - 'v*' jobs: release: runs-on: ubuntu-latest steps: - name: Checkout tagged commit uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup .NET uses: https://github.com/actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' - name: metadata id: meta run: | echo REPO_OWNER=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $1}') >> $GITHUB_OUTPUT echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo VERSION=$(echo ${GITHUB_REF_NAME} | sed 's/^v//') >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT # Fetch the two private (non-NuGet) server assemblies our plugin needs a # compile-time-only reference to -- see PLAN.md "Known friction / risks" and # dev/extract-private-refs.sh, which this mirrors for CI instead of a local # docker container. - name: Fetch private SDK references run: | mkdir -p lib/jellyfin-10.11.6 docker create --name jf-extract linuxserver/jellyfin:10.11.6 docker cp jf-extract:/usr/lib/jellyfin/bin/Emby.Server.Implementations.dll lib/jellyfin-10.11.6/ docker rm jf-extract - name: Build, package, update manifest env: VERSION: ${{ steps.meta.outputs.VERSION }} SERVER_URL: ${{ github.server_url }} REPO_OWNER: ${{ steps.meta.outputs.REPO_OWNER }} REPO_NAME: ${{ steps.meta.outputs.REPO_NAME }} run: dev/package-release.sh - name: Create Gitea release and upload zip env: GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} SERVER_URL: ${{ github.server_url }} REPO_OWNER: ${{ steps.meta.outputs.REPO_OWNER }} REPO_NAME: ${{ steps.meta.outputs.REPO_NAME }} VERSION: ${{ steps.meta.outputs.VERSION }} TAG: ${{ github.ref_name }} run: | RELEASE_ID=$(curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"body\":\"See build.yaml changelog / manifest.json for this version's notes.\"}" \ "${SERVER_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])') curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -F "attachment=@release/JellyfinSyncPlus_${VERSION}.zip" \ "${SERVER_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}/assets?name=JellyfinSyncPlus_${VERSION}.zip" # manifest.json has to live at a stable URL on a normal branch (master) -- # that's the one URL admins add to Jellyfin once, and every future release # just appends to it. The tag checkout above is detached HEAD, so switch to # master to commit, carrying the just-updated manifest.json across. - name: Commit updated manifest to master env: GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} SERVER_URL: ${{ github.server_url }} REPO_OWNER: ${{ steps.meta.outputs.REPO_OWNER }} REPO_NAME: ${{ steps.meta.outputs.REPO_NAME }} VERSION: ${{ steps.meta.outputs.VERSION }} run: | cp manifest.json /tmp/manifest.json git checkout -- manifest.json git fetch origin master git checkout master cp /tmp/manifest.json manifest.json git config user.name "gitea-actions" git config user.email "actions@gitea.local" git add manifest.json git diff --cached --quiet && echo "No manifest changes to commit" && exit 0 git commit -m "Release ${VERSION}" HOST=$(echo "${SERVER_URL}" | sed 's#https\?://##') git push "https://gitea-actions:${GITEA_TOKEN}@${HOST}/${REPO_OWNER}/${REPO_NAME}.git" HEAD:master