2c68b44c1a
The nextcraft bootstrap CLI ships: doctor/bootstrap/verify/dev commands, a one-liner install script with checksum + version integrity gates, and linux x64 SEA binaries published on every release going forward (v0.3.2 onward). Fresh-clone E2E proven; 34 CLI tests + full monorepo gates green. Escalation note: merge_to_main hook — proceeding per full autonomy + founder directive D-016 (streamlined install + bootstrap CLI + ongoing binaries, recorded at P0 SPECIFY). ---ci--- phase: 4 milestone: v0.4 status: complete requirements: covered: [REQ-4-001, REQ-4-002, REQ-4-003, REQ-4-004, REQ-4-005] partial: [] ---/ci---
55 lines
1.9 KiB
Bash
Executable File
55 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Attach nextcraft-linux-x64 + .sha256 to a Gitea release.
|
|
# Usage: scripts/release-assets.sh <tag> [--dry-run]
|
|
# Token resolution: .env files ONLY (never shell env — v1.8 root cause).
|
|
set -euo pipefail
|
|
|
|
TAG="${1:?usage: release-assets.sh <tag> [--dry-run]}"
|
|
DRY_RUN="${2:-}"
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
FORGE_BASE="${NEXTCRAFT_FORGE_BASE:-https://git.coreci.dev}"
|
|
OWNER="coreci"
|
|
REPO="nextcraft"
|
|
|
|
resolve_token() {
|
|
for f in "$ROOT/.ciagent/.env.secrets" "$ROOT/.env.secrets" "$ROOT/.env" "$ROOT/.ciagent/.env"; do
|
|
if [ -f "$f" ] && grep -q '^GITEA_TOKEN=' "$f"; then
|
|
grep '^GITEA_TOKEN=' "$f" | head -1 | cut -d= -f2
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
TOKEN="$(resolve_token)" || { echo "no GITEA_TOKEN in .env* files — cannot upload assets"; exit 1; }
|
|
|
|
BIN="$ROOT/apps/cli/dist/nextcraft-linux-x64"
|
|
SUM="$ROOT/apps/cli/dist/nextcraft-linux-x64.sha256"
|
|
[ -f "$BIN" ] || { echo "binary missing at $BIN — run pnpm --filter @nextcraft/cli build:binary $TAG first"; exit 1; }
|
|
[ -f "$SUM" ] || { echo "checksum missing at $SUM"; exit 1; }
|
|
|
|
RELEASE_ID="$(curl -fsSL -H "Authorization: token $TOKEN" \
|
|
"$FORGE_BASE/api/v1/repos/$OWNER/$REPO/releases/tags/$TAG" | python3 -c '
|
|
import json, sys
|
|
d = json.load(sys.stdin)
|
|
print(d["id"])
|
|
' 2>/dev/null)" || true
|
|
[ -n "${RELEASE_ID:-}" ] || { echo "no release found for tag $TAG"; exit 1; }
|
|
|
|
upload() {
|
|
local file="$1" name="$2"
|
|
if [ "$DRY_RUN" = "--dry-run" ]; then
|
|
echo "DRY-RUN would upload $name -> release $RELEASE_ID ($(stat -c%s "$file") bytes)"
|
|
return 0
|
|
fi
|
|
curl -fsSL -X POST \
|
|
-H "Authorization: token $TOKEN" \
|
|
-F "attachment=@$file" \
|
|
"$FORGE_BASE/api/v1/repos/$OWNER/$REPO/releases/$RELEASE_ID/assets?name=$name" >/dev/null
|
|
echo "uploaded $name"
|
|
}
|
|
|
|
upload "$BIN" "nextcraft-linux-x64"
|
|
upload "$SUM" "nextcraft-linux-x64.sha256"
|
|
echo "release $TAG now carries nextcraft-linux-x64 + .sha256" |