Skip to content

Commit e992633

Browse files
committed
avoid patching existing releases
1 parent 877dc20 commit e992633

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Makefile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,22 @@ _mkrelease: _release_check $(NAMESPACE)
109109
git push $(REMOTE_GH) $(RELEASE_BRANCH)
110110
$(eval RELEASE_SHA=$(shell git rev-parse $(RELEASE_BRANCH)))
111111
$(eval CREATE_JSON=$(shell printf '{"tag_name": "%s","target_commitish": "%s","draft": false,"prerelease": %s}' $(RELEASE_TAG) $(RELEASE_SHA) $(PRERELEASE)))
112-
( \
112+
@( \
113113
cd $(CURDIR) ; \
114114
id=$$(curl -sLH "Authorization: token $(GH_TOKEN)" $(GH_URL)/repos/$(GH_PROJECT)/releases/tags/$(RELEASE_TAG) | jq -Me .id) ; \
115-
if [ $$id = "null" ]; then \
116-
echo " * attempting to create release $(RELEASE_TAG) ..." ; \
117-
id=$$(curl -sLH "Authorization: token $(GH_TOKEN)" -X POST --data '$(CREATE_JSON)' $(GH_URL)/repos/$(GH_PROJECT)/releases | jq -Me .id) ; \
118-
else \
119-
echo " * attempting to update release $(RELEASE_TAG) ..." ; \
120-
git push $(REMOTE_GH) :$(RELEASE_TAG) ; \
121-
curl -sLH "Authorization: token $(GH_TOKEN)" -X PATCH --data '$(CREATE_JSON)' $(GH_URL)/repos/$(GH_PROJECT)/releases/$$id ; \
115+
if [ $$id != "null" ]; then \
116+
echo " * removing existing release $(RELEASE_TAG) ..." ; \
117+
curl -sLH "Authorization: token $(GH_TOKEN)" -X DELETE $(GH_URL)/repos/$(GH_PROJECT)/releases/$$id ; \
118+
git push $(REMOTE_GH) :$(RELEASE_TAG) ; \
122119
fi ; \
120+
echo " * creating release $(RELEASE_TAG) ..." ; \
121+
id=$$(curl -sLH "Authorization: token $(GH_TOKEN)" -X POST --data '$(CREATE_JSON)' $(GH_URL)/repos/$(GH_PROJECT)/releases | jq -Me .id) ; \
123122
[ $$id = "null" ] && echo " !! unable to create release" && exit 1 ; \
124123
echo " * uploading dist/$(NAMESPACE) to release $(RELEASE_TAG) ($$id) ..." ; \
125124
curl -sL -H "Authorization: token $(GH_TOKEN)" -H "Content-Type: text/x-shellscript" --data-binary @"dist/$(NAMESPACE)" -X POST $(GH_UPLOAD_URL)/repos/$(GH_PROJECT)/releases/$$id/assets?name=$(NAMESPACE) &>/dev/null ; \
126125
)
127-
128-
$(info * publishing to get.iceburg.net/$(NAMESPACE)/latest-$(RELEASE_BRANCH)/)
129126
@( \
127+
echo " * publishing to get.iceburg.net/$(NAMESPACE)/latest-$(RELEASE_BRANCH)/" ; \
130128
set -e ; \
131129
cd $(CURDIR)/dist ; \
132130
for file in * ; do \

0 commit comments

Comments
 (0)