lint:
	~/go/bin/golangci-lint run

fix:
	gofmt -s -w .
	~/go/bin/golangci-lint run --fix
	npx @biomejs/biome@latest check --write --unsafe .

dev:
	@test -f ~/go/bin/air || (echo "Installing air..." && go install github.com/air-verse/air@latest)
	~/go/bin/air

build:
	go build -ldflags="-s -w" -o server dashboard-server.go

docker:
	docker build -t snowflake-dashboard:latest .

test:
	go test -v ./...

release:
	curl -s -X POST "https://git.lonecloud.dev/api/v1/repos/lone-cloud/snowflake-dashboard/actions/workflows/release.yml/dispatches" \
		-H "Authorization: token $$(cat ~/.config/forgejo-token)" \
		-H "Content-Type: application/json" \
		-d '{"ref":"master"}'

.PHONY: lint fix check dev build docker test release
