default: help
help:
	@echo "Please use \`make <target>' where <target> is one of:"
	@echo "  help             to show this message"
	@echo "  test             to run unit tests"
	@echo "  docs             to build the collection documentation"
	@echo "  clean            to remove temporary build files"

test:
	molecule test --all

build:
	ansible-galaxy collection build --force .

install: build
	ansible-galaxy collection install --force *.tar.gz

sanity:
	podman run -it --rm -v $$PWD:/ansible_collections/jugasit/ai -w /ansible_collections/jugasit/ai python:3.11 bash -c "pip install -r requirements-dev.txt ; ansible-test sanity --python=3.11"

release:
	git checkout main
	git pull
	git checkout -b release-$(VERSION)
	mkdir -p changelogs/fragments
	echo "release_summary: $(SUMMARY)" > changelogs/fragments/release_summary.yml
	echo "$(VERSION)" > VERSION
	yq -yi '.version = "$(VERSION)"' galaxy.yml
	antsibull-changelog release
	git add .
	git commit -m "Release $(VERSION)"
	git push origin release-$(VERSION)
clean:
	rm -rf *.tar.gz

.PHONY: help test release clean build install
