feat: 发布 billing 0.1.0

This commit is contained in:
chuan
2026-08-15 22:31:12 +08:00
parent d2a0bebe16
commit 6775b64f1a
41 changed files with 1742 additions and 159 deletions
+2 -2
View File
@@ -14,6 +14,6 @@ if [[ -n "$unformatted" ]]; then
fi
go list -mod=readonly ./... >/dev/null
CGO_ENABLED=1 go test ./...
CGO_ENABLED=1 go build -tags cshared -buildmode=c-shared -o bin/cpa-ext.so ./cmd/cpa-ext
CGO_ENABLED=1 go build -tags cshared -buildmode=c-shared -o bin/billing.so ./cmd/billing
echo "Built: $root/bin/cpa-ext.so"
echo "Built: $root/bin/billing.so"
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
version="${1:-0.1.0}"
target="linux_amd64"
name="billing_${version}_${target}"
artifact="$root/bin/billing.so"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid version: $version" >&2
exit 1
fi
if [[ ! -f "$artifact" ]]; then
echo "Missing $artifact; run scripts/build.sh first." >&2
exit 1
fi
stage="$(mktemp -d)"
trap 'rm -rf "$stage"' EXIT
package_dir="$stage/$name"
mkdir -p "$package_dir" "$root/dist"
install -m 0755 "$artifact" "$package_dir/billing.so"
install -m 0644 "$root/README.md" "$package_dir/README.md"
install -m 0644 "$root/config.example.yaml" "$package_dir/config.example.yaml"
printf '%s\n' \
"name=billing" \
"version=$version" \
"target=linux/amd64" \
"native_abi=1" \
"rpc_schema=3" \
"cliproxyapi_revision=f43aad7637ad813745bf7d341acb5663617570c5" \
>"$package_dir/VERSION.txt"
archive="$root/dist/$name.tar.gz"
tar -czf "$archive" -C "$stage" "$name"
sha256sum "$archive" >"$archive.sha256"
echo "Packaged: $archive"
echo "Checksum: $archive.sha256"