Modeled on cflmy/marqdo-cli: - Woodpecker pipeline with fmt/clippy/tests, MSRV 1.89 lane, a lane that builds the pinned core CLI and runs the real Analysis integration tests, and a tag-only release lane - GitHub Actions mirror with the same gates plus artifact upload and prerelease publication - scripts/ci.sh local lanes (test/minimum/core/release/all) - package-release.sh now refuses a dirty tree or SOURCE_SHA mismatch, runs a locked release build and records SOURCE_SHA, RELEASE_INFO.json and SHA-256 - verify-release.sh cold-installs the archive into an isolated MARQDO_TOOL_HOME and runs the documented install/help/compile/query/check/remove smoke path - docs/ci.md and docs/releasing.md document gates, explicit non-gates and the beta freeze/tag procedure
63 lines
2.4 KiB
Bash
Executable File
63 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build a reproducible release archive from the exact current commit.
|
|
#
|
|
# Refuses a dirty tree (unless ALLOW_DIRTY=1), records SOURCE_SHA and
|
|
# RELEASE_INFO.json inside the bundle, and emits a sha256 checksum. CI sets
|
|
# SOURCE_SHA=CI_COMMIT_SHA; the value must match HEAD or packaging fails.
|
|
set -eu
|
|
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' "$ROOT/Cargo.toml" | head -1)
|
|
TARGET=${TARGET:-x86_64-unknown-linux-gnu}
|
|
SPEC_SHA=${SOURCE_SHA:-$(git -C "$ROOT" rev-parse HEAD)}
|
|
HEAD_SHA=$(git -C "$ROOT" rev-parse HEAD)
|
|
DIRTY=$(git -C "$ROOT" status --porcelain)
|
|
|
|
if [ "${ALLOW_DIRTY:-0}" != "1" ] && [ -n "$DIRTY" ]; then
|
|
echo "package-release: working tree is dirty; commit or pass ALLOW_DIRTY=1" >&2
|
|
exit 2
|
|
fi
|
|
if [ "$SPEC_SHA" != "$HEAD_SHA" ]; then
|
|
echo "package-release: SOURCE_SHA $SPEC_SHA does not match HEAD $HEAD_SHA" >&2
|
|
exit 2
|
|
fi
|
|
|
|
"$ROOT/scripts/cargo.sh" build --release --locked
|
|
|
|
DIST="$ROOT/dist/marqdo-knowledge-$VERSION-$TARGET"
|
|
rm -rf "$DIST"
|
|
mkdir -p "$DIST/bin" "$DIST/docs" "$DIST/spec" "$DIST/docs/releases"
|
|
cp "$ROOT/target/release/marqdo-knowledge" "$DIST/bin/marqdo-knowledge"
|
|
chmod 755 "$DIST/bin/marqdo-knowledge"
|
|
cp "$ROOT/packaging/tool.json" "$DIST/tool.json"
|
|
cp "$ROOT/README.md" "$ROOT/CHANGELOG.md" "$ROOT/LICENSE-APACHE" "$DIST/"
|
|
cp "$ROOT/docs/STATUS.md" "$DIST/docs/"
|
|
cp -r "$ROOT/docs/architecture" "$DIST/docs/"
|
|
cp -r "$ROOT/docs/releases/." "$DIST/docs/releases/"
|
|
cp "$ROOT/spec/knowledge.md" "$DIST/spec/"
|
|
printf '%s\n' "$SPEC_SHA" > "$DIST/SOURCE_SHA"
|
|
cat > "$DIST/RELEASE_INFO.json" <<JSON
|
|
{
|
|
"schema": "marqdo.knowledge.release",
|
|
"schema_version": 1,
|
|
"tool": "marqdo-knowledge",
|
|
"version": "$VERSION",
|
|
"channel": "beta",
|
|
"source_sha": "$SPEC_SHA",
|
|
"target": "$TARGET",
|
|
"tool_api_revision": 1,
|
|
"analysis_revision": 3,
|
|
"sqlite_schema_revision": 1,
|
|
"core_baseline": "cflmy/marqdo-cli@4bbefc92449ee480c8a2c89b0308feb4cda8d0e7 (3.0.0-rc.4)",
|
|
"rust": "$(rustc --version)",
|
|
"cargo": "$(cargo --version)",
|
|
"built_at_utc": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
}
|
|
JSON
|
|
cp "$DIST/RELEASE_INFO.json" "$ROOT/dist/RELEASE_INFO.json"
|
|
|
|
ARCHIVE="$DIST.tar.gz"
|
|
tar -C "$(dirname "$DIST")" -czf "$ARCHIVE" "$(basename "$DIST")"
|
|
( cd "$(dirname "$ARCHIVE")" && sha256sum "$(basename "$ARCHIVE")" > "$(basename "$ARCHIVE").sha256" )
|
|
printf 'archive: %s\n' "$ARCHIVE"
|
|
cat "$ARCHIVE.sha256"
|