Skip to content

Commit 3732c85

Browse files
committed
update makefile to support creating releases.
1 parent 52e3930 commit 3732c85

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Makefile

+24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,31 @@ WP_DST=$(BASE_DST)/blockchain
99
TALKS=$(BASE_SRC)/talks
1010
TALKS_DST=$(BASE_DST)/talks
1111

12+
VERSION=$(strip $(shell cat version))
13+
RELEASE_VERSION=v$(VERSION)
14+
GIT_BRANCH=$(strip $(shell git symbolic-ref --short HEAD))
15+
GIT_VERSION="$(strip $(shell git rev-parse --short HEAD))"
16+
GIT_LOG=$(shell git log `git describe --tags --abbrev=0`..HEAD --pretty="tformat:%h | %s [%an]\n" | sed "s/\"/'/g")
17+
RELEASE_BODY=release on branch __$(GIT_BRANCH)__\n\n$(GIT_LOG)
18+
RELEASE_DATA='{"tag_name": "$(RELEASE_VERSION)", "name": "$(RELEASE_VERSION)", "target_commitish": "master", "body": "$(RELEASE_BODY)"}'
19+
RELEASE_URL=https://api.github.com/repos/tyrchen/unchained/releases
1220

1321
sync:
1422
@$(GDRIVE_DOWNLOAD) $(WP) $(WP_DST)
1523
@$(GDRIVE_DOWNLOAD) $(TALKS) $(TALKS_DST)
24+
25+
26+
release:
27+
ifeq ($(GITHUB_TOKEN),)
28+
@echo "To generate a release, you need to define 'GITHUB_TOKEN' in your env."
29+
else
30+
@echo "Create a release on $(RELEASE_VERSION)"
31+
@git tag -a $(RELEASE_VERSION) -m "Release $(RELEASE_VERSION). Revision is: $(GIT_VERSION)"
32+
@git push origin $(RELEASE_VERSION)
33+
curl -s -d $(RELEASE_DATA) "$(RELEASE_URL)?access_token=$(GITHUB_TOKEN)"
34+
endif
35+
36+
delete-release:
37+
@echo "Delete a release on $(RELEASE_VERSION)"
38+
@git tag -d $(RELEASE_VERSION) | true
39+
@git push -f -d origin $(RELEASE_VERSION) | true

version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

0 commit comments

Comments
 (0)