Add Makefile target to publish release

This commit is contained in:
sfigato 2020-05-22 16:10:47 +02:00
parent 08f79e2e0f
commit 2bd9cb93bf
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
2 changed files with 26 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/output/*
/.token

View File

@ -3,6 +3,7 @@ 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:
@ -13,7 +14,7 @@ output/sendmail-dev: output
go build -o output/sendmail-dev ./...
clean:
rm output/*
rm -f output/*
build: clean output/sendmail
@ -34,14 +35,36 @@ bumpvers-major:
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
PHONY: bumpvers-minor bumpvers-major release-min release-maj clean docker-build new-release