# Makefile # Image version VERSION ?= latest # Builder name BUILDER_NAME ?= mediafusion-builder # Docker image name IMAGE_NAME = mediafusion # Docker repository DOCKER_REPO = mhdzumair # Platforms to build for PLATFORMS = linux/amd64,linux/arm64 # Docker image with version as tag DOCKER_IMAGE = $(DOCKER_REPO)/$(IMAGE_NAME):$(VERSION) # Proxy settings HTTP_PROXY = http://172.17.0.1:1081 HTTPS_PROXY = http://172.17.0.1:1081 # Variables to hold version tags and contributor names VERSION_OLD ?= VERSION_NEW ?= CONTRIBUTORS ?= $(shell git log --pretty=format:'%an' $(VERSION_OLD)..$(VERSION_NEW) | sort | uniq) # Claude API settings CLAUDE_MODEL ?= claude-3-5-sonnet-20241022 MAX_TOKENS ?= 1024 ANTHROPIC_VERSION ?= 2023-06-01 # Reddit post settings SUBREDDIT ?= MediaFusion REDDIT_POST_TITLE ?= "MediaFusion $(VERSION_NEW) Update - What's New?" .PHONY: build tag push prompt update-version generate-notes generate-reddit-post 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 "/ $$temp_file; \ jq -r '.content[] | select(.type=="text") | .text' $$temp_file || { echo "Failed to generate release notes using Claude AI, response: $$(cat $$temp_file)"; rm $$temp_file; exit 1; } ; \ rm $$temp_file generate-reddit-post: ifndef VERSION_OLD @echo "Error: VERSION_OLD is not set" @exit 1 endif ifndef VERSION_NEW @echo "Error: VERSION_NEW is not set" @exit 1 endif ifndef ANTHROPIC_API_KEY @echo "Error: ANTHROPIC_API_KEY is not set" @exit 1 endif @PROMPT_CONTENT=$$(make prompt-reddit VERSION_OLD=$(VERSION_OLD) VERSION_NEW=$(VERSION_NEW) | jq -sRr @json); \ if [ -z "$$PROMPT_CONTENT" ]; then \ echo "Failed to generate Reddit post using Claude AI, prompt content is empty"; \ exit 1; \ fi; \ temp_file=$$(mktemp); \ curl -s https://api.anthropic.com/v1/messages \ --header "x-api-key: $(ANTHROPIC_API_KEY)" \ --header "anthropic-version: $(ANTHROPIC_VERSION)" \ --header "content-type: application/json" \ --data "{\"model\":\"$(CLAUDE_MODEL)\",\"max_tokens\":$(MAX_TOKENS),\"messages\":[{\"role\":\"user\",\"content\":$$PROMPT_CONTENT}]}" > $$temp_file; \ jq -r '.content[] | select(.type=="text") | .text' $$temp_file || { echo "Failed to generate Reddit post using Claude AI, response: $$(cat $$temp_file)"; rm $$temp_file; exit 1; } ; \ rm $$temp_file all: build-multi