diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..028027e --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,19 @@ +name: '🏗️ Build Plugin' + +on: + push: + branches: + - main + - dev + paths-ignore: + - '**/*.md' + pull_request: + branches: + - main + paths-ignore: + - '**/*.md' + workflow_dispatch: + +jobs: + call: + uses: ./.github/workflows/build_internal.yaml diff --git a/.github/workflows/build_internal.yaml b/.gitea/workflows/build_internal.yaml similarity index 100% rename from .github/workflows/build_internal.yaml rename to .gitea/workflows/build_internal.yaml diff --git a/.gitea/workflows/release_automation.yml b/.gitea/workflows/release_automation.yml new file mode 100644 index 0000000..0ee9bd7 --- /dev/null +++ b/.gitea/workflows/release_automation.yml @@ -0,0 +1,102 @@ +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://git.mahom03-spacecloud.de/${{ github.repository }}/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: akkuman/gitea-release-action@v1 + with: + server_url: "https://git.mahom03-spacecloud.de" + body: ${{ env.CHANGELOG }} + token: ${{ secrets.GITHUB_TOKEN }} + files: ${{ env.ZIP_PATH }} + name: "v${{ env.VERSION }}" + tag_name: "v${{ env.VERSION }}" + draft: false + prerelease: false diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..2f561e6 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>jellyfin/.github//renovate-presets/default" + ] +} \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 028027e..f290747 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,17 +3,16 @@ name: '🏗️ Build Plugin' on: push: branches: - - main - - dev + - master paths-ignore: - '**/*.md' pull_request: branches: - - main + - master paths-ignore: - '**/*.md' workflow_dispatch: jobs: call: - uses: ./.github/workflows/build_internal.yaml + uses: jellyfin/jellyfin-meta-plugins/.github/workflows/build.yaml@master diff --git a/.github/workflows/release_automation.yml b/.github/workflows/release_automation.yml index 0ee9bd7..eaba8a8 100644 --- a/.github/workflows/release_automation.yml +++ b/.github/workflows/release_automation.yml @@ -70,7 +70,7 @@ jobs: REPO_OWNER="${{ github.repository_owner }}" REPO_NAME="${{ github.event.repository.name }}" VERSION="${{ env.VERSION }}" - DOWNLOAD_URL="https://git.mahom03-spacecloud.de/${{ github.repository }}/releases/download/v$VERSION/Jellyfin.Plugin.Seasonals.zip" + 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 }}" @@ -90,13 +90,12 @@ jobs: file_pattern: manifest.json - name: Create Release - uses: akkuman/gitea-release-action@v1 + uses: softprops/action-gh-release@v2 with: - server_url: "https://git.mahom03-spacecloud.de" - body: ${{ env.CHANGELOG }} - token: ${{ secrets.GITHUB_TOKEN }} - files: ${{ env.ZIP_PATH }} - name: "v${{ env.VERSION }}" tag_name: "v${{ env.VERSION }}" + name: "v${{ env.VERSION }}" + # body: ${{ env.CHANGELOG }} + files: ${{ env.ZIP_PATH }} draft: false prerelease: false + generate_release_notes: true