summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorZhineng Li <[email protected]>2026-02-13 08:31:32 +0800
committerZhineng Li <[email protected]>2026-02-13 08:31:32 +0800
commita1afa64410df7fee2e735bbeea59b9f8bf3b4330 (patch)
tree4bc275e2de607b6dae93ae7cb889f0c58d8828d5 /Makefile
parent328602707213990715fccbb98f46731b19289902 (diff)
downloadacs-metadata-build-a1afa64410df7fee2e735bbeea59b9f8bf3b4330.tar.gz
acs-metadata-build-a1afa64410df7fee2e735bbeea59b9f8bf3b4330.zip
add release target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 9 insertions, 1 deletions
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)/"