makefile: refactor release target

This commit is contained in:
Austin English 2021-03-28 13:57:21 -05:00
parent f0fa222215
commit 4e6812b731
2 changed files with 8 additions and 13 deletions

View File

@ -105,14 +105,14 @@ image:
write_image: $(PRAWNOS_IMAGE)
$(PRAWNOS_IMAGE_SCRIPTS_WRITE_IMAGE) $(PRAWNOS_IMAGE) $(PDEV)
.PHONE: release
release: $(PRAWNOS_IMAGE_GIT_GZ)
.PHONY: release
release: $(PRAWNOS_IMAGE_RELEASE_GZ)
$(PRAWNOS_IMAGE):
$(MAKE) image
$(PRAWNOS_IMAGE_GIT_GZ): $(PRAWNOS_IMAGE)
gzip -c $(PRAWNOS_IMAGE) > $(PRAWNOS_IMAGE_GIT_GZ)
$(PRAWNOS_IMAGE_RELEASE_GZ): $(PRAWNOS_IMAGE)
gzip -c $(PRAWNOS_IMAGE) > $(PRAWNOS_IMAGE_RELEASE_GZ)
#:::::::::::::::::::::::::::::: dependency management ::::::::::::::::::::::::::

View File

@ -107,23 +107,18 @@ endif
PRAWNOS_GIT_SHA := $(shell git rev-parse HEAD)
PRAWNOS_GIT_BRANCH := $(shell git branch --show-current)
# GithubCI doesn't show any branch, extract it from ${GITHUB_REF##*/} as a fallback
ifeq ($(PRAWNOS_GIT_BRANCH),)
PRAWNOS_GIT_BRANCH := $(shell echo ${GITHUB_REF##*/})
endif
# If we're not on master, append the branch name/sha1 to the imagename
ifeq ($(PRAWNOS_GIT_BRANCH),master)
# FIXME: use tag here instead of PRAWNOS_SUITE
PRAWNOS_IMAGE := $(PRAWNOS_ROOT)/CrawfishOS-$(PRAWNOS_SUITE)-$(TARGET).img
else
PRAWNOS_IMAGE := $(PRAWNOS_ROOT)/CrawfishOS-$(TARGET)-git-$(PRAWNOS_GIT_BRANCH)-$(PRAWNOS_GIT_SHA).img
endif
PRAWNOS_IMAGE_GIT_GZ := $(PRAWNOS_IMAGE).gz
PRAWNOS_IMAGE_BASE := CrawfishOS-$(TARGET)-BASE
# For releases, use the git tag
PRAWNOS_GIT_TAG := $(shell git describe --tags --dirty)
PRAWNOS_IMAGE_RELEASE_GZ := CrawfishOS-$(PRAWNOS_GIT_TAG)-$(TARGET).img.gz
### BUILD SCRIPTS
PRAWNOS_BUILD_SCRIPTS := $(PRAWNOS_SCRIPTS)/BuildScripts