This repository has been archived on 2026-11-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
unkin-agent 1c0e47167c
ci / goreleaser-check (push) Has been cancelled
ci / release-snapshot (push) Failing after 12m18s
ci / go (push) Failing after 12m20s
ci / actions (push) Failing after 12m20s
ci / ci (push) Failing after 12m21s
Prepare for GitHub migration (#24)
Moves node-lookup to IUCLabs/node-lookup on GitHub; it must carry no internal hostnames or Woodpecker release.

- Loads PuppetDB, Puppetboard and domain from config (flags > env > ~/.config > /etc) for all 3 tools; errors name the config paths
- Ships packaging/config.example.yaml as an RPM doc
- Rewrites .goreleaser.yaml: raw binaries + amd64 RPM with completions, signed checksums
- Adds GitHub CI/release workflows, CODEOWNERS, zizmor config, README
- Makes patch/minor/major draft a GitHub release; make rpm runs a goreleaser snapshot
- Removes the Woodpecker release pipeline, nfpm.yaml and build-rpm.sh

Reviewed-on: #24
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-26 23:09:43 +11:00

67 lines
2.6 KiB
Makefile

BINARY := node-lookup
# All shipped binaries and the package path each is built from. node-lookup is
# the module root; the companion tools live under cmd/.
BINARIES := node-lookup pburl pblastreport
DIST := dist
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
GOFLAGS := -ldflags="-s -w -X main.version=$(VERSION)"
OS ?= $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
# The Go package path for a binary: node-lookup is the module root, the
# companion tools live under cmd/. Usable inside a shell for-loop over $(BINARIES).
pkgpath = $$([ "$$b" = "node-lookup" ] && echo . || echo ./cmd/$$b)
.PHONY: all build test lint fmt clean install completions rpm patch minor major
all: build
# Each main package needs its own -o, so they are built individually rather
# than with a single ./... invocation.
build:
@for b in $(BINARIES); do \
echo "building $$b"; \
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build $(GOFLAGS) -o $(DIST)/$$b $(pkgpath) || exit 1; \
done
test:
go test -v -race ./...
lint:
golangci-lint run ./...
fmt:
gofmt -w .
clean:
rm -rf $(DIST) $(BINARIES) completions
install:
go install $(GOFLAGS) ./...
# Generate bash/zsh/fish completions for every binary into completions/.
completions:
./scripts/completions.sh
# Snapshot release: raw binaries plus the RPM in dist/, unsigned.
rpm:
GOTOOLCHAIN=auto go run github.com/goreleaser/goreleaser/v2@v2.20.2 release --snapshot --clean --skip=sign
DEFAULT_BRANCH ?= main
# Draft the release with generated notes, then push the tag; the release
# workflow attaches assets to the draft and publishes it.
patch minor major:
@git fetch --quiet --tags origin $(DEFAULT_BRANCH)
@test "$$(git branch --show-current)" = "$(DEFAULT_BRANCH)" || { echo "ERROR: not on $(DEFAULT_BRANCH)"; exit 1; }
@test -z "$$(git status --porcelain)" || { echo "ERROR: working tree not clean"; exit 1; }
@test "$$(git rev-parse HEAD)" = "$$(git rev-parse origin/$(DEFAULT_BRANCH))" || { echo "ERROR: HEAD is not origin/$(DEFAULT_BRANCH)"; exit 1; }
@LATEST=$$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' | head -1); \
NEW=$$(echo "$${LATEST:-v0.0.0}" | sed 's/^v//' | awk -F. -v b=$@ '{ \
if (b == "major") print "v" ($$1+1) ".0.0"; \
else if (b == "minor") print "v" $$1 "." ($$2+1) ".0"; \
else print "v" $$1 "." $$2 "." ($$3+1) }'); \
SHA=$$(git rev-parse HEAD); \
gh release create "$$NEW" --draft --target "$$SHA" --generate-notes --title "$$NEW" || exit 1; \
git push origin "$$SHA:refs/tags/$$NEW" || { gh release delete "$$NEW" --yes; exit 1; }