sendmail/Makefile

71 lines
2.0 KiB
Makefile

VERS_MAJOR := 0
VERS_MINOR := 5
VERSION := $(VERS_MAJOR).$(VERS_MINOR)
NEW_MINOR := $$(( $(VERS_MINOR) + 1 ))
NEW_MAJOR := $$(( $(VERS_MAJOR) + 1 ))
GITEA_URL := https://git.abbiamoundominio.org
output:
output/sendmail: output
go build -o output/sendmail -ldflags "-X main.version=$(VERSION)" ./...
output/sendmail-dev: output
go build -o output/sendmail-dev ./...
clean:
rm -f output/*
build: clean output/sendmail
docker-build:
docker build --build-arg=version=$(VERSION) -t leophys/mailer:$(VERSION) .
dev-build: clean output/sendmail-dev
bumpvers-minor:
sed -i"" "s/VERS_MINOR := $(VERS_MINOR)/VERS_MINOR := $(NEW_MINOR)/" Makefile
git add Makefile
git commit -m "Bump version $(VERSION) -> $(VERS_MAJOR).$(NEW_MINOR)"
git tag $(VERS_MAJOR).$(NEW_MINOR)
bumpvers-major:
sed -i"" "s/VERS_MAJOR := $(VERS_MAJOR)/VERS_MAJOR := $$(( $(VERS_MAJOR) + 1 ))/" Makefile
git add Makefile
git commit -m "Bump version $(VERSION) -> $(NEW_MAJOR).$(VERS_MINOR)"
git tag $(NEW_MAJOR).$(VERS_MINOR)
new-release:
last_tag=$$(git tag|tail -n2|head -n1); \
release_id=$$(curl -X POST \
"$(GITEA_URL)/api/v1/repos/blallo/sendmail/releases" \
-H "Authorization: token $$(cat .token)" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"body\": \"$$(git log $${last_tag}..HEAD~)\", \"draft\": false, \"name\": \"$(VERSION)\", \"prerelease\": false, \"tag_name\": \"$(VERSION)\", \"target_commitish\": \"$$(git rev-parse HEAD)\" }") \
| jq '.id'; \
curl -X POST \
"$(GITEA_URL)/api/v1/repos/blallo/sendmail/releases/$${release_id}/assets?name=sendmail" \
-H "Authorization: token $$(cat .token)" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@output/sendmail"
release-min:
make bumpvers-minor
make build
make docker-build
git push
git push --tags
make new-release
release-maj:
make bumpvers-major
make build
make docker-build
git push
git push --tags
make new-release
PHONY: bumpvers-minor bumpvers-major release-min release-maj clean docker-build new-release