send token in the header instead of api call (#3764)

Automatically submitted.
This commit is contained in:
Zou Nengren
2020-03-24 14:22:43 +08:00
committed by GitHub
parent 40c7b9174b
commit 5adefab053

View File

@@ -112,14 +112,15 @@ tar:
.PHONY: github-push
github-push:
@echo Releasing: $(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:]]'))
@$(eval RELEASE:=$(shell curl -s -d '{"tag_name": "v$(VERSION)", "name": "v$(VERSION)"}' -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" "https://api.github.com/repos/$(GITHUB)/$(NAME)/releases" | grep -m 1 '"id"' | tr -cd '[[:digit:]]'))
@echo ReleaseID: $(RELEASE)
@( cd release; for asset in `ls -A *tgz`; do \
echo $$asset; \
curl -o /dev/null -X POST \
-H "Content-Type: application/gzip" \
-H "Authorization: token ${GITHUB_ACCESS_TOKEN}"
--data-binary "@$$asset" \
"https://uploads.github.com/repos/$(GITHUB)/$(NAME)/releases/$(RELEASE)/assets?name=$${asset}&access_token=${GITHUB_ACCESS_TOKEN}" ; \
"https://uploads.github.com/repos/$(GITHUB)/$(NAME)/releases/$(RELEASE)/assets?name=$${asset}" ; \
done )
@( cd release; for asset in `ls -A *tgz`; do \
sha256sum $$asset > $$asset.sha256; \
@@ -128,8 +129,9 @@ github-push:
echo $$asset; \
curl -o /dev/null -X POST \
-H "Content-Type: text/plain" \
-H "Authorization: token ${GITHUB_ACCESS_TOKEN}"
--data-binary "@$$asset" \
"https://uploads.github.com/repos/$(GITHUB)/$(NAME)/releases/$(RELEASE)/assets?name=$${asset}&access_token=${GITHUB_ACCESS_TOKEN}" ; \
"https://uploads.github.com/repos/$(GITHUB)/$(NAME)/releases/$(RELEASE)/assets?name=$${asset}" ; \
done )
.PHONY: docker-build