From 481891e3248717c042df4eb82c47779fae901a7c Mon Sep 17 00:00:00 2001 From: Mohamed Zumair Date: Sat, 2 Nov 2024 07:15:16 +0530 Subject: [PATCH] Update version handling and add branding description (#341) Removed git revision from the version string in the API response. Added a new field for branding description in settings and integrated it in the home template. Introduced VERSION argument and environment variable in the Dockerfile. --- .github/workflows/main.yml | 10 +--------- Makefile | 9 +++------ api/main.py | 3 ++- db/config.py | 4 ++-- deployment/Dockerfile | 4 ++++ docs/configuration.md | 1 - resources/html/home.html | 1 + 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cdeea8a..86afe42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,10 +24,6 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get short SHA - id: short_sha - run: echo "GIT_REV=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV - - name: Build and push id: docker_build uses: docker/build-push-action@v5 @@ -36,7 +32,7 @@ jobs: file: ./deployment/Dockerfile platforms: linux/amd64,linux/arm64 push: true - build-args: GIT_REV=${{ env.GIT_REV }} + build-args: VERSION=${{ github.ref_name }} tags: | mhdzumair/mediafusion:v${{ github.ref_name }} mhdzumair/mediafusion:latest @@ -64,10 +60,6 @@ jobs: - name: Install zip run: sudo apt-get install -y zip - - name: Get short SHA - id: short_sha - run: echo "GIT_REV=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV - - name: Build addon run: make -C kodi diff --git a/Makefile b/Makefile index 26392ed..d16743c 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,6 @@ # Image version VERSION ?= latest -# Last commit ID -GIT_REV ?= $(shell git rev-parse --short HEAD) - # Builder name BUILDER_NAME ?= mediafusion-builder @@ -33,7 +30,7 @@ CONTRIBUTORS ?= .PHONY: build tag push prompt build: - docker build --build-arg GIT_REV=$(GIT_REV) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . + docker build --build-arg VERSION=$(VERSION) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . build-multi: @if ! docker buildx ls | grep -q $(BUILDER_NAME); then \ @@ -44,9 +41,9 @@ build-multi: docker buildx use $(BUILDER_NAME); \ fi docker buildx inspect --bootstrap - docker buildx build --platform $(PLATFORMS) --build-arg GIT_REV=$(GIT_REV) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . --push + docker buildx build --platform $(PLATFORMS) --build-arg VERSION=$(VERSION) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . --push if [ "$(VERSION)" != "beta" ]; then \ - docker buildx build --platform $(PLATFORMS) --build-arg GIT_REV=$(GIT_REV) -t $(DOCKER_REPO)/$(IMAGE_NAME):latest -f deployment/Dockerfile . --push; \ + docker buildx build --platform $(PLATFORMS) --build-arg VERSION=$(VERSION) -t $(DOCKER_REPO)/$(IMAGE_NAME):latest -f deployment/Dockerfile . --push; \ fi push: docker push $(DOCKER_IMAGE) diff --git a/api/main.py b/api/main.py index a1a0ddf..6fad897 100644 --- a/api/main.py +++ b/api/main.py @@ -123,8 +123,9 @@ async def get_home(request: Request): "request": request, "addon_name": settings.addon_name, "logo_url": settings.logo_url, - "version": f"{settings.version}-{settings.git_rev[:7]}", + "version": f"{settings.version}", "description": settings.description, + "branding_description": settings.branding_description, }, ) diff --git a/db/config.py b/db/config.py index d2a5f37..f60143c 100644 --- a/db/config.py +++ b/db/config.py @@ -5,15 +5,15 @@ from pydantic_settings import BaseSettings class Settings(BaseSettings): # Core Application Settings addon_name: str = "MediaFusion" - version: str = "4.0.5" + version: str = "1.0.0" description: str = ( "Universal Stremio Add-on for Movies, Series, Live TV & Sports Events. Source: https://github.com/mhdzumair/MediaFusion" ) + branding_description: str = "" contact_email: str = "mhdzumair@gmail.com" host_url: str secret_key: str = Field(..., max_length=32, min_length=32) api_password: str - git_rev: str = "stable" logging_level: str = "INFO" logo_url: str = ( "https://raw.githubusercontent.com/mhdzumair/MediaFusion/main/resources/images/mediafusion_logo.png" diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 9e7cbad..fa8580b 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -26,6 +26,8 @@ RUN pip install --user pipenv && \ FROM python:3.12-slim-bookworm +ARG VERSION + WORKDIR /mediafusion # Copy the Python environment and other necessary files from the builder stage @@ -34,6 +36,8 @@ COPY --from=builder /etc/group /etc/passwd /etc/ ENV PATH="/home/mediafusion/.local/bin:$PATH" +ENV VERSION=${VERSION} + COPY . . # set folder permissions diff --git a/docs/configuration.md b/docs/configuration.md index 290c85d..c0f52d2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -13,7 +13,6 @@ These settings define the basic configuration and identity of your MediaFusion i - **host_url** (required): The URL where MediaFusion is hosted. - **secret_key** (required): A 32-character secret key for securely signing the session. Must be exactly 32 characters long. - **api_password** (required): The password for accessing the API endpoints. -- **git_rev** (default: `"stable"`): The Git revision or version of the application. - **logging_level** (default: `"INFO"`): The logging level of the application. Valid options are typically DEBUG, INFO, WARNING, ERROR, and CRITICAL. - **logo_url** (default: GitHub RAW Addon URL): The URL of the MediaFusion logo. - **is_public_instance** (default: `False`): Set to `True` for community instances that do not require authentication to access the data but protect the `/scraper` endpoint and uploading live TV data endpoints. diff --git a/resources/html/home.html b/resources/html/home.html index eec9688..eb1840c 100644 --- a/resources/html/home.html +++ b/resources/html/home.html @@ -17,6 +17,7 @@

{{ addon_name }} - {{ version }}

+ {{ branding_description | safe }}

🔎 Advanced Scraping Capabilities

Tap into a world of content with our enhanced scraping features: