# Release-train targets. Root Makefile is a trusted-image pin; invoke with
# `make -f ops/release/Makefile <target>` from the repository root.
REPO_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
META_PYTHON ?= python3

.PHONY: listing-check predicate next-canary

listing-check:
	@$(META_PYTHON) $(REPO_ROOT)/ops/scripts/release_train.py listing-check

predicate:
	@test -n "$(CHANGED_FILES)" || (echo "CHANGED_FILES is required" >&2; exit 2)
	@$(META_PYTHON) $(REPO_ROOT)/ops/scripts/release_train.py predicate --changed-files "$(CHANGED_FILES)"

next-canary:
	@test -n "$(VERSION)" || (echo "VERSION is required" >&2; exit 2)
	@$(META_PYTHON) $(REPO_ROOT)/ops/scripts/release_train.py next-version --current "$(VERSION)" --channel canary --stamp "$(STAMP)"
