From 90e028eb3b5338bffd0b4085a258e07518543a1b Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Tue, 30 Dec 2025 15:26:47 +0100 Subject: [PATCH] feat: Add GitHub Actions workflow for automated plugin releases. --- .github/workflows/changelog.yaml | 20 ----- .github/workflows/command-dispatch.yaml | 13 --- .github/workflows/command-rebase.yaml | 16 ---- .github/workflows/publish.yaml | 18 ---- .github/workflows/release_automation.yml | 100 +++++++++++++++++++++++ .github/workflows/scan-codeql.yaml | 20 ----- .github/workflows/test.yaml | 18 ---- 7 files changed, 100 insertions(+), 105 deletions(-) delete mode 100644 .github/workflows/changelog.yaml delete mode 100644 .github/workflows/command-dispatch.yaml delete mode 100644 .github/workflows/command-rebase.yaml delete mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/release_automation.yml delete mode 100644 .github/workflows/scan-codeql.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml deleted file mode 100644 index 5b3c3be..0000000 --- a/.github/workflows/changelog.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: '๐Ÿ“ Create/Update Release Draft & Release Bump PR' - -on: - push: - branches: - - master - paths-ignore: - - build.yaml - workflow_dispatch: - repository_dispatch: - types: - - update-prep-command - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/changelog.yaml@master - with: - repository-name: jellyfin/jellyfin-plugin-template - secrets: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/command-dispatch.yaml b/.github/workflows/command-dispatch.yaml deleted file mode 100644 index 1b5e4ee..0000000 --- a/.github/workflows/command-dispatch.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Allows for the definition of PR and Issue /commands -name: '๐Ÿ“Ÿ Slash Command Dispatcher' - -on: - issue_comment: - types: - - created - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/command-dispatch.yaml@master - secrets: - token: . diff --git a/.github/workflows/command-rebase.yaml b/.github/workflows/command-rebase.yaml deleted file mode 100644 index 7847e20..0000000 --- a/.github/workflows/command-rebase.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: '๐Ÿ”€ PR Rebase Command' - -on: - repository_dispatch: - types: - - rebase-command - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/command-rebase.yaml@master - with: - rebase-head: ${{ github.event.client_payload.pull_request.head.label }} - repository-full-name: ${{ github.event.client_payload.github.payload.repository.full_name }} - comment-id: ${{ github.event.client_payload.github.payload.comment.id }} - secrets: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 80483cf..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: '๐Ÿš€ Publish Plugin' - -on: - release: - types: - - released - workflow_dispatch: - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/publish.yaml@master - with: - version: ${{ github.event.release.tag_name }} - is-unstable: ${{ github.event.release.prerelease }} - secrets: - deploy-host: ${{ secrets.DEPLOY_HOST }} - deploy-user: ${{ secrets.DEPLOY_USER }} - deploy-key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/release_automation.yml b/.github/workflows/release_automation.yml new file mode 100644 index 0000000..180fd9f --- /dev/null +++ b/.github/workflows/release_automation.yml @@ -0,0 +1,100 @@ +name: Auto Release Plugin + +on: + push: + branches: + - main + paths-ignore: + - '.github/**' + - 'README.md' + - 'jellyfin.ruleset' + - '.gitignore' + - '.editorconfig' + - 'LICENSE' + - 'logo.png' + +jobs: + build-and-release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: '9.x' + + - name: Read Version from Manifest + id: read_version + run: | + VERSION=$(jq -r '.[0].versions[0].version' manifest.json) + CHANGELOG=$(jq -r '.[0].versions[0].changelog' manifest.json) + TARGET_ABI=$(jq -r '.[0].versions[0].targetAbi' manifest.json) + + echo "Detected Version: $VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + # Escape newlines in changelog for GITHUB_ENV + echo "CHANGELOG<> $GITHUB_ENV + echo "$CHANGELOG" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Build and Zip + shell: bash + run: | + # Inject version from manifest into the build + dotnet build Jellyfin.Plugin.Seasonals/Jellyfin.Plugin.Seasonals.csproj --configuration Release --output bin/Publish /p:Version=${{ env.VERSION }} /p:AssemblyVersion=${{ env.VERSION }} + + cd bin/Publish + zip -r Jellyfin.Plugin.Seasonals.zip * + cd ../.. + + # Calculate hash + HASH=$(md5sum bin/Publish/Jellyfin.Plugin.Seasonals.zip | awk '{ print $1 }') + TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + # Export variables for next steps + echo "ZIP_HASH=$HASH" >> $GITHUB_ENV + echo "BUILD_TIME=$TIME" >> $GITHUB_ENV + echo "ZIP_PATH=bin/Publish/Jellyfin.Plugin.Seasonals.zip" >> $GITHUB_ENV + + - name: Update manifest.json + shell: bash + run: | + REPO_OWNER="${{ github.repository_owner }}" + REPO_NAME="${{ github.event.repository.name }}" + VERSION="${{ env.VERSION }}" + DOWNLOAD_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/v$VERSION/Jellyfin.Plugin.Seasonals.zip" + + echo "Updating manifest.json with:" + echo "Hash: ${{ env.ZIP_HASH }}" + echo "Time: ${{ env.BUILD_TIME }}" + echo "Url: $DOWNLOAD_URL" + + jq --arg hash "${{ env.ZIP_HASH }}" \ + --arg time "${{ env.BUILD_TIME }}" \ + --arg url "$DOWNLOAD_URL" \ + '.[0].versions[0].checksum = $hash | .[0].versions[0].timestamp = $time | .[0].versions[0].sourceUrl = $url' \ + manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json + + - name: Commit manifest.json + uses: stefanzweifel/git-auto-commit-action@v7 + with: + commit_message: "Update manifest.json for release v${{ env.VERSION }} [skip ci]" + file_pattern: manifest.json + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + tag_name: "v${{ env.VERSION }}" + name: "v${{ env.VERSION }}" + body: ${{ env.CHANGELOG }} + files: ${{ env.ZIP_PATH }} + draft: false + prerelease: false diff --git a/.github/workflows/scan-codeql.yaml b/.github/workflows/scan-codeql.yaml deleted file mode 100644 index ca8b0b0..0000000 --- a/.github/workflows/scan-codeql.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: '๐Ÿ”ฌ Run CodeQL' - -on: - push: - branches: [ master ] - paths-ignore: - - '**/*.md' - pull_request: - branches: [ master ] - paths-ignore: - - '**/*.md' - schedule: - - cron: '24 2 * * 4' - workflow_dispatch: - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/scan-codeql.yaml@master - with: - repository-name: jellyfin/jellyfin-plugin-template diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index d90b14d..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: '๐Ÿงช Test Plugin' - -on: - push: - branches: - - master - paths-ignore: - - '**/*.md' - pull_request: - branches: - - master - paths-ignore: - - '**/*.md' - workflow_dispatch: - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/test.yaml@master