Skip to content

Commit f4696eb

Browse files
authored
fix(build): fix release build (#4150) (#4151)
This fixes issues that arose after applying the previous fix #4141. commit: d83c07b (main), cherry-pick
1 parent 94c46aa commit f4696eb

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

builder/Makefile.release

+26-28
Original file line numberDiff line numberDiff line change
@@ -154,41 +154,39 @@ release: \
154154
.check_$(CMD_TAR) \
155155
.check_$(CMD_CHECKSUM) \
156156
.check_$(CMD_GITHUB)
157-
#
158-
# note: TAGS created by release-snapshot workflow
159-
#
160157

161158
#
162-
# RELEASE
159+
# release rule recipes
163160
#
164-
165161
ifneq ("$(SNAPSHOT)", "1")
166162
#
167-
# create release notes (x86_64 only, other arches will be added after release)
168-
#
169-
ifeq ($(ARCH),x86_64)
170-
$(CMD_TOUCH) $(RELEASE_NOTES)
171-
echo '## Docker Image' >> $(RELEASE_NOTES)
172-
echo '- `docker pull docker.io/$(PUSH_DOCKER_REPO):$(IMAGE_TAG)`' >> $(RELEASE_NOTES);
173-
echo ' ' >> $(RELEASE_NOTES);
174-
echo '## Docker Images (per architecture) ' >> $(RELEASE_NOTES)
175-
echo '- `docker pull docker.io/$(PUSH_DOCKER_REPO):x86_64-$(IMAGE_TAG)`' >> $(RELEASE_NOTES);
176-
echo '- `docker pull docker.io/$(PUSH_DOCKER_REPO):aarch64-$(IMAGE_TAG)`' >> $(RELEASE_NOTES);
177-
endif
178-
#
179-
# release it (x86_64 only, other arches will be added after release)
180-
#
181-
ifeq ($(ARCH),x86_64)
182-
$(CMD_GITHUB) release create $(SNAPSHOT_VERSION) $(OUT_ARCHIVE) $(OUT_CHECKSUMS) --title $(SNAPSHOT_VERSION) --notes-file $(RELEASE_NOTES)
183-
endif
184-
#
185-
# add artifacts to the already created release (by x86_64 arch)
186-
#
187-
ifeq ($(ARCH),aarch64)
188-
$(CMD_GITHUB) release upload $(SNAPSHOT_VERSION) $(OUT_ARCHIVE) $(OUT_CHECKSUMS)
163+
# official release
164+
#
165+
166+
# if not released yet, create a github release without artifacts.
167+
# be aware that if changes are made to the release branch, the github release
168+
# must be deleted so the next triggered action can recreate it updated.
169+
# note: docker TAGS created by release workflows (not here).
170+
@( \
171+
$(CMD_GITHUB) release view $(SNAPSHOT_VERSION) > /dev/null 2>&1 && \
172+
echo "Release $(SNAPSHOT_VERSION) already exists" \
173+
) || \
174+
( \
175+
echo "Creating release $(SNAPSHOT_VERSION)" && \
176+
echo '## Docker Image' > $(RELEASE_NOTES) && \
177+
echo '- `docker pull docker.io/$(PUSH_DOCKER_REPO):$(IMAGE_TAG)`' >> $(RELEASE_NOTES) && \
178+
echo ' ' >> $(RELEASE_NOTES) && \
179+
echo '## Docker Images (per architecture) ' >> $(RELEASE_NOTES) && \
180+
echo '- `docker pull docker.io/$(PUSH_DOCKER_REPO):x86_64-$(IMAGE_TAG)`' >> $(RELEASE_NOTES) && \
181+
echo '- `docker pull docker.io/$(PUSH_DOCKER_REPO):aarch64-$(IMAGE_TAG)`' >> $(RELEASE_NOTES) && \
182+
$(CMD_GITHUB) release create $(SNAPSHOT_VERSION) --title $(SNAPSHOT_VERSION) --notes-file $(RELEASE_NOTES) \
183+
)
184+
185+
# upload artifacts to release (clobbering existing with same name)
186+
@echo "Uploading artifacts to release $(SNAPSHOT_VERSION)" && \
187+
$(CMD_GITHUB) release upload --clobber $(SNAPSHOT_VERSION) $(OUT_ARCHIVE) $(OUT_CHECKSUMS)
189188
endif
190189

191-
endif
192190

193191
#
194192
# build tracee

0 commit comments

Comments
 (0)