ci: complete component release propagation for issue #10
ci/woodpecker/push/eco Pipeline is pending
ci/woodpecker/pr/eco Pipeline is pending

Add authoritative component-release helpers, evidence-aware reconcile with
freshness and root upstream dispatch, least-privilege secrets, image scan
and multi-arch build gates, and pin active component publish workflows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-11-27 19:30:18 +08:00
1 parent 068f91cd31
commit a61f3442bc
39 files changed
+2130 -111

No files matched your search

@@ -0,0 +1,49 @@
#!/bin/sh
# Deterministic source archive + release-evidence.json for this component.
#
# Required env:
# COMPONENT_ID catalog id (e.g. std-text)
# REPOSITORY owner/name (e.g. cflmy/marqdo-std-text)
# Optional:
# VERSION without leading v (default: derived from CI_COMMIT_TAG)
# SOURCE_SHA full commit (default: HEAD)
# OUT_DIR default dist
# DEPENDENCY repeatable write_evidence dependency specs via env DEP_ARGS
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
COMPONENT_ID=${COMPONENT_ID:?COMPONENT_ID is required}
REPOSITORY=${REPOSITORY:?REPOSITORY is required}
SOURCE_SHA=${SOURCE_SHA:-$(git -C "$ROOT" rev-parse HEAD)}
OUT_DIR=${OUT_DIR:-dist}
TAG=${CI_COMMIT_TAG:-${TAG:-}}
if [ -n "${VERSION:-}" ]; then
:
elif [ -n "$TAG" ]; then
VERSION=${TAG#v}
else
echo "package.sh: set VERSION or CI_COMMIT_TAG" >&2
exit 1
fi
TAG=${TAG:-v$VERSION}
python3 "$ROOT/scripts/release/package_source.py" \
--root "$ROOT" \
--component-id "$COMPONENT_ID" \
--version "$VERSION" \
--out-dir "$OUT_DIR"
ARCHIVE=$(ls "$ROOT/$OUT_DIR"/marqdo-"$COMPONENT_ID"-"$VERSION"-source.tar.gz)
SHAFILE="$ARCHIVE.sha256"
EVIDENCE_ARGS="--component-id $COMPONENT_ID --repository $REPOSITORY --tag $TAG --source-sha $SOURCE_SHA --asset $ARCHIVE --asset $SHAFILE --out $ROOT/$OUT_DIR/release-evidence.json"
if [ -n "${CI_PIPELINE_NUMBER:-}" ]; then
EVIDENCE_ARGS="$EVIDENCE_ARGS --pipeline-number $CI_PIPELINE_NUMBER"
fi
if [ -n "${CI_PIPELINE_URL:-}" ]; then
EVIDENCE_ARGS="$EVIDENCE_ARGS --pipeline-url $CI_PIPELINE_URL"
fi
# shellcheck disable=SC2086
eval "python3 \"$ROOT/scripts/release/write_evidence.py\" $EVIDENCE_ARGS ${DEP_ARGS:-}"
echo "$ARCHIVE"
echo "$SHAFILE"
echo "$ROOT/$OUT_DIR/release-evidence.json"
@@ -0,0 +1,33 @@
# Protected publish workflow: tag or manual only.
# Holds the publish token. Push/PR lanes must never mount this secret.
when:
- event: [tag, manual]
steps:
publish:
image: git.cflmy.cn/cflmy/marqdo-ci-shell:3.0.0-rc.5
environment:
GITEA_PUBLISH_TOKEN:
from_secret: gitea_publish_token
COMPONENT_ID: "${COMPONENT_ID}"
REPOSITORY: "${REPOSITORY}"
commands:
- |
set -eu
test -n "${GITEA_PUBLISH_TOKEN:?gitea_publish_token secret missing}"
test -n "${CI_COMMIT_TAG:?publish requires a tag}"
export SOURCE_SHA="${CI_COMMIT_SHA}"
export VERSION="${CI_COMMIT_TAG#v}"
export TAG="${CI_COMMIT_TAG}"
sh scripts/package.sh
ARCHIVE="dist/marqdo-${COMPONENT_ID}-${VERSION}-source.tar.gz"
python3 scripts/release/publish_gitea.py \
--repo "$REPOSITORY" \
--tag "$TAG" \
--target "$SOURCE_SHA" \
--prerelease \
--body "Automated source release for ${COMPONENT_ID} ${TAG}." \
--asset "$ARCHIVE" \
--asset "${ARCHIVE}.sha256" \
--asset dist/release-evidence.json \
--evidence-out dist/gitea-publish-result.json
@@ -0,0 +1,20 @@
# Fast-path notification after a completed Gitea release.
# Hint only; root reconcile verifies authoritative releases. Lost calls are
# recovered by the root release-reconcile cron.
when:
event: [release]
steps:
notify:
image: git.cflmy.cn/cflmy/marqdo-ci-shell:3.0.0-rc.5
environment:
WOODPECKER_NOTIFY_TOKEN:
from_secret: woodpecker_notify_token
COMPONENT_ID: "${COMPONENT_ID}"
commands:
- |
set -eu
test -n "${WOODPECKER_NOTIFY_TOKEN:?woodpecker_notify_token secret missing}"
python3 scripts/release/notify_root.py \
--hint-component "${COMPONENT_ID}" \
--hint-tag "${CI_COMMIT_TAG:-}"