Commit c25a2e0f authored by Yong Tang's avatar Yong Tang Committed by Miek Gieben

Replace gh-release with curl (#1896)

* Replace gh-release with curl

This fix tries to address the issue raised in 1895 where
gh-release is deprecated.

As GitHub provides API that could be accessed easily,
and gh-release itself is just a wrapper to the API,
this fix replaces gh-release with the direct interaction
with GitHub API, so that it could be maintained by coredns
team.

This fix fixes 1895.
Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Added `-o /dev/null`
Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>
parent 1ef9e312
...@@ -46,8 +46,8 @@ EMPTY:= ...@@ -46,8 +46,8 @@ EMPTY:=
SPACE:=$(EMPTY) $(EMPTY) SPACE:=$(EMPTY) $(EMPTY)
COMMA:=$(EMPTY),$(EMPTY) COMMA:=$(EMPTY),$(EMPTY)
ifeq (, $(shell which gh-release)) ifeq (, $(shell which curl))
$(error "No gh-release in $$PATH, install with: go get github.com/progrium/gh-release") $(error "No curl in $$PATH, please install")
endif endif
ifeq (, $(shell which manifest-tool)) ifeq (, $(shell which manifest-tool))
...@@ -115,7 +115,14 @@ tar: ...@@ -115,7 +115,14 @@ tar:
.PHONY: upload .PHONY: upload
upload: upload:
@echo Releasing: $(VERSION) @echo Releasing: $(VERSION)
gh-release create $(GITHUB)/$(NAME) $(VERSION) $(eval RELEASE:=$(shell curl -s -d '{"tag_name": "v$(VERSION)", "name": "v$(VERSION)"}' "https://api.github.com/repos/$(GITHUB)/$(NAME)/releases?access_token=${GITHUB_ACCESS_TOKEN}" | grep -m 1 '"id"' | tr -cd '[[:digit:]]'))
@echo ReleaseID: $(RELEASE)
@for asset in `ls -A release`; do \
curl -o /dev/null -X POST \
-H "Content-Type: application/gzip" \
--data-binary "@release/$$asset" \
"https://uploads.github.com/repos/$(GITHUB)/$(NAME)/releases/$(RELEASE)/assets?name=$${asset}&access_token=${GITHUB_ACCESS_TOKEN}" ; \
done
.PHONY: docker-build .PHONY: docker-build
docker-build: tar docker-build: tar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment