From a1afa64410df7fee2e735bbeea59b9f8bf3b4330 Mon Sep 17 00:00:00 2001 From: Zhineng Li Date: Fri, 13 Feb 2026 08:31:32 +0800 Subject: add release target --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f7987a8..f346841 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ BUILD_DIR ?= build TAG ?= $(shell date +%Y%m%d) JSON_TARBALL := $(BUILD_DIR)/release-$(TAG)-json.tar.gz PHP_TARBALL := $(BUILD_DIR)/release-$(TAG)-php.tar.gz +R2_BUCKET ?= -.PHONY: build build-php update clean +.PHONY: build build-php update release clean build: build-json build-php @@ -31,5 +32,12 @@ $(BUILD_DIR)/.metadata.zh.updated: LANGUAGE=ZH_CN BUILD_DIR="$(BUILD_DIR)/json" ./scripts/update-metadata.sh touch "$@" +release: +ifndef R2_BUCKET + $(error R2_BUCKET is missing. Please set it to your Cloudflare R2 bucket name.) +endif + find "$(BUILD_DIR)" -type f \( -name "release-$(TAG)-*.tar.gz" -o -name "release-$(TAG)-*.tar.gz.sha256" \) \ + \( -exec sh -c 'f="$$1"; name=$$(basename "$$f"); npx wrangler r2 object put "$(R2_BUCKET)/releases/$$name" --remote --file "$$f"' sh {} \; -o -quit \) + clean: rm -rf "$(BUILD_DIR)/" -- cgit v1.2.3