Files
arti-pack/Makefile
T
unkin-agent 2960321b0b
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
Publish tagged source zips to artifactapi
Add a tag-triggered release pipeline and a package target that builds the
archive shape arti-pack's own installer consumes.
2026-09-09 21:06:09 +10:00

49 lines
1.5 KiB
Makefile

.PHONY: test lint fmt pre-commit package patch minor major _tag
VERSION ?= $(shell git describe --tags --always)
# Archive names drop the leading "v", the way tag source archives do.
BARE_VERSION = $(patsubst v%,%,$(VERSION))
DIST = dist
ARCHIVE = $(DIST)/arti-pack-$(BARE_VERSION).zip
test:
nvim --headless -l tests/run.lua
lint:
luacheck lua tests
fmt:
stylua lua tests
pre-commit:
@uvx pre-commit run --all-files
# The prefix directory is what arti-pack's own extractor strips on install.
package:
@mkdir -p $(DIST)
git archive --format=zip --prefix=arti-pack-$(BARE_VERSION)/ -o $(ARCHIVE) HEAD
@echo $(ARCHIVE)
# Bump helpers — read the latest semver tag and create the next one.
# If no tag exists yet, start from v0.0.0.
_LATEST = $(shell git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' | head -1)
_BASE = $(if $(_LATEST),$(_LATEST),v0.0.0)
_MAJ = $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f1)
_MIN = $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f2)
_PAT = $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f3)
patch:
@NEW=v$(_MAJ).$(_MIN).$(shell expr $(_PAT) + 1); \
git tag -a $$NEW -m "Release $$NEW" && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
minor:
@NEW=v$(_MAJ).$(shell expr $(_MIN) + 1).0; \
git tag -a $$NEW -m "Release $$NEW" && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
major:
@NEW=v$(shell expr $(_MAJ) + 1).0.0; \
git tag -a $$NEW -m "Release $$NEW" && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
_tag:
git push origin $(TAG)