2020-04-29 10:12:03 +02:00
|
|
|
VERS_MAJOR := 0
|
2020-05-22 16:13:31 +02:00
|
|
|
VERS_MINOR := 6
|
2020-04-29 10:12:03 +02:00
|
|
|
VERSION := $(VERS_MAJOR).$(VERS_MINOR)
|
|
|
|
NEW_MINOR := $$(( $(VERS_MINOR) + 1 ))
|
|
|
|
NEW_MAJOR := $$(( $(VERS_MAJOR) + 1 ))
|
2020-05-22 16:10:47 +02:00
|
|
|
GITEA_URL := https://git.abbiamoundominio.org
|
2020-04-29 10:12:03 +02:00
|
|
|
|
|
|
|
output:
|
|
|
|
|
|
|
|
output/sendmail: output
|
|
|
|
go build -o output/sendmail -ldflags "-X main.version=$(VERSION)" ./...
|
|
|
|
|
2020-04-30 14:02:09 +02:00
|
|
|
output/sendmail-dev: output
|
|
|
|
go build -o output/sendmail-dev ./...
|
|
|
|
|
|
|
|
clean:
|
2020-05-22 16:10:47 +02:00
|
|
|
rm -f output/*
|
2020-04-30 14:02:09 +02:00
|
|
|
|
|
|
|
build: clean output/sendmail
|
|
|
|
|
2020-05-05 10:25:47 +02:00
|
|
|
docker-build:
|
|
|
|
docker build --build-arg=version=$(VERSION) -t leophys/mailer:$(VERSION) .
|
|
|
|
|
2020-04-30 14:02:09 +02:00
|
|
|
dev-build: clean output/sendmail-dev
|
2020-04-29 10:12:03 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2020-05-22 16:10:47 +02:00
|
|
|
new-release:
|
2020-05-22 16:13:31 +02:00
|
|
|
@last_tag=$$(git tag|tail -n2|head -n1); \
|
|
|
|
diffs=$$(git log --pretty=oneline --abbrev-commit $${last_tag}..HEAD~); \
|
|
|
|
release_id=$$(curl -X POST -s \
|
2020-05-22 16:10:47 +02:00
|
|
|
"$(GITEA_URL)/api/v1/repos/blallo/sendmail/releases" \
|
|
|
|
-H "Authorization: token $$(cat .token)" \
|
|
|
|
-H "accept: application/json" \
|
|
|
|
-H "Content-Type: application/json" \
|
2020-05-22 16:13:31 +02:00
|
|
|
-d "{\"body\": \"${diffs}\", \"draft\": false, \"name\": \"$(VERSION)\", \"prerelease\": false, \"tag_name\": \"$(VERSION)\", \"target_commitish\": \"$$(git rev-parse HEAD)\" }" \
|
|
|
|
| jq '.id'); \
|
|
|
|
curl -X POST -s \
|
2020-05-22 16:10:47 +02:00
|
|
|
"$(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"
|
|
|
|
|
2020-04-29 10:12:03 +02:00
|
|
|
release-min:
|
|
|
|
make bumpvers-minor
|
|
|
|
make build
|
2020-05-05 10:25:47 +02:00
|
|
|
make docker-build
|
2020-05-22 16:13:31 +02:00
|
|
|
git push unit
|
|
|
|
git push --tags unit
|
2020-05-22 16:10:47 +02:00
|
|
|
make new-release
|
2020-04-29 10:12:03 +02:00
|
|
|
|
|
|
|
release-maj:
|
|
|
|
make bumpvers-major
|
|
|
|
make build
|
2020-05-05 10:25:47 +02:00
|
|
|
make docker-build
|
2020-05-22 16:13:31 +02:00
|
|
|
git push unit
|
|
|
|
git push --tags unit
|
2020-05-22 16:10:47 +02:00
|
|
|
make new-release
|
2020-04-29 10:12:03 +02:00
|
|
|
|
2020-05-22 16:10:47 +02:00
|
|
|
PHONY: bumpvers-minor bumpvers-major release-min release-maj clean docker-build new-release
|