diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 86afe427..ee4f281e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,12 +5,53 @@ on: types: [ created ] jobs: + update_version: + runs-on: ubuntu-latest + outputs: + previous_version: ${{ steps.extract_versions.outputs.PREVIOUS_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract versions + id: extract_versions + run: | + # Extract current version from release body + BODY="${{ github.event.release.body }}" + if ! PREVIOUS_VERSION=$(echo "$BODY" | grep -o '/compare/.*\.\.\.' | sed 's/\/compare\///' | sed 's/\.\.\.//' || true); then + echo "Error: Failed to extract previous version from release body" + exit 1 + fi + VERSION="${GITHUB_REF#refs/tags/v}" + echo "PREVIOUS_VERSION=${PREVIOUS_VERSION}" >> "$GITHUB_OUTPUT" + echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Update version numbers + if: "!github.event.release.prerelease" + run: | + make update-version VERSION_NEW=${{ steps.extract_versions.outputs.VERSION }} + + - name: Commit and push version updates + if: "!github.event.release.prerelease" + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add -A + git commit -m "chore: update version to ${{ steps.extract_versions.outputs.VERSION }}" + git push origin HEAD:main + mediafusion_docker_build: + needs: update_version + if: "!github.event.release.prerelease" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: main # Use main branch with updated versions - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -34,18 +75,22 @@ jobs: push: true build-args: VERSION=${{ github.ref_name }} tags: | - mhdzumair/mediafusion:v${{ github.ref_name }} + mhdzumair/mediafusion:${{ github.ref_name }} mhdzumair/mediafusion:latest - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} kodi_build: + needs: update_version + if: "!github.event.release.prerelease" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: main # Use main branch with updated versions - name: Set up Python uses: actions/setup-python@v5 @@ -57,16 +102,59 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel - - name: Install zip - run: sudo apt-get install -y zip + - name: Install required packages + run: sudo apt-get install -y zip xmlstarlet + + - name: Build addon and repository + run: | + make -C kodi + # Validate build artifacts + for file in kodi/plugin.video.mediafusion-*.zip kodi/repository.mediafusion-*.zip; do + if [ ! -f "$file" ]; then + echo "Error: Build artifact $file not found" + exit 1 + fi + done + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: kodi/dist + destination_dir: kodi/dist + keep_files: true + enable_jekyll: false + force_orphan: true + + - name: Upload Release Assets + uses: softprops/action-gh-release@v2 + with: + files: | + kodi/plugin.video.mediafusion-*.zip + kodi/repository.mediafusion-*.zip + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} + + generate_release_notes: + needs: update_version + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Build addon - run: make -C kodi + - name: Install jq + run: sudo apt-get install -y jq - - name: List build directory - run: ls -la kodi + - name: Generate Release Notes + env: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + run: | + make generate-notes VERSION_OLD=${{ needs.update_version.outputs.previous_version }} VERSION_NEW=${{ github.ref_name }} > release_notes.md - - name: Upload Release Asset + - name: Update Release Notes uses: softprops/action-gh-release@v2 with: - files: kodi/plugin.video.mediafusion-*.zip + body_path: release_notes.md + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index d16743c8..1c626630 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,33 @@ VERSION_OLD ?= VERSION_NEW ?= CONTRIBUTORS ?= -.PHONY: build tag push prompt +# Claude API settings +CLAUDE_MODEL ?= claude-3-5-sonnet-20241022 +MAX_TOKENS ?= 1024 +ANTHROPIC_VERSION ?= 2023-06-01 + +.PHONY: build tag push prompt update-version generate-notes build: docker build --build-arg VERSION=$(VERSION) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . +update-version: +ifndef VERSION_NEW + @echo "Error: VERSION_NEW is not set. Please set it like: make update-version VERSION_NEW=4.1.0" + @exit 1 +endif + @echo "Updating version to $(VERSION_NEW)..." + # Update main addon.xml + @sed -i -e "/ + + + + https://mhdzumair.github.io/MediaFusion/kodi/dist/zips/addons.xml + https://mhdzumair.github.io/MediaFusion/kodi/dist/zips/addons.xml.md5 + https://mhdzumair.github.io/MediaFusion/kodi/dist/zips/ + + + + MediaFusion Repository + Repository for MediaFusion Kodi addon + all + + mediafusion_logo.png + mediafusion_logo.png + + + \ No newline at end of file diff --git a/kodi/repository.mediafusion/mediafusion_logo.png b/kodi/repository.mediafusion/mediafusion_logo.png new file mode 100644 index 00000000..d6f95717 Binary files /dev/null and b/kodi/repository.mediafusion/mediafusion_logo.png differ