Your Name e40746a917
Some checks failed
CI - 4NK Node / Code Quality (push) Failing after 38s
CI - 4NK Node / Unit Tests (push) Failing after 36s
CI - 4NK Node / Integration Tests (push) Successful in 2m54s
CI - 4NK Node / Security Tests (push) Failing after 36s
CI - 4NK Node / Docker Build & Test (push) Failing after 16s
CI - 4NK Node / Documentation Tests (push) Successful in 11s
CI - 4NK Node / Performance Tests (push) Successful in 33s
CI - 4NK Node / Notify (push) Failing after 1s
chore(template-sync): aligner avec 4NK_template (.cursor/.gitea/.gitea_template/scripts/ignores)
2025-08-27 11:37:04 +02:00

66 lines
2.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
# Release guard script
# Checks: tests, docs updated, compile, version ↔ changelog ↔ tag consistency, release type
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd)"
cd "$ROOT_DIR"
mode="${RELEASE_TYPE:-ci-verify}" # values: latest | wip | ci-verify
echo "[release-guard] mode=$mode"
# 1) Basic presence checks
[[ -f CHANGELOG.md ]] || { echo "CHANGELOG.md manquant"; exit 1; }
version_file="VERSION"
[[ -f TEMPLATE_VERSION ]] && version_file="TEMPLATE_VERSION"
[[ -f "$version_file" ]] || { echo "$version_file manquant"; exit 1; }
# 2) Extract version
project_version=$(tr -d '\r' < "$version_file" | head -n1 | sed 's/^v//')
[[ -n "$project_version" ]] || { echo "Version vide dans $version_file"; exit 1; }
echo "[release-guard] version=$project_version"
# 3) Changelog checks
if ! grep -Eq "^## \\[$project_version\\]" CHANGELOG.md; then
if [[ "$mode" == "wip" ]]; then
grep -Eq "^## \\[Unreleased\\]" CHANGELOG.md || { echo "Section [Unreleased] absente du CHANGELOG"; exit 1; }
else
echo "Entrée CHANGELOG pour version $project_version manquante"; exit 1;
fi
fi
# 4) Tests (optional best-effort)
if [[ -x tests/run_all_tests.sh ]]; then
echo "[release-guard] exécution tests/run_all_tests.sh"
./tests/run_all_tests.sh || { echo "Tests en échec"; exit 1; }
else
echo "[release-guard] tests absents (ok)"
fi
# 5) Build/compile (optional based on project)
if [[ -d sdk_relay ]] && command -v cargo >/dev/null 2>&1; then
echo "[release-guard] cargo build (sdk_relay)"
(cd sdk_relay && cargo build --quiet) || { echo "Compilation échouée"; exit 1; }
else
echo "[release-guard] build spécifique non applicable (ok)"
fi
# 6) Release type handling
case "$mode" in
latest)
;;
wip)
# En wip, autoriser versions suffixées; pas dexigence dentrée datée
;;
ci-verify)
# En CI, on valide juste la présence de CHANGELOG et version
;;
*)
echo "RELEASE_TYPE invalide: $mode (latest|wip|ci-verify)"; exit 1;
;;
esac
echo "[release-guard] OK"