Stabilize release hooks and workflows

This commit is contained in:
h3p 2026-03-31 11:50:12 +02:00
parent be8c07126d
commit 16d790021c
No known key found for this signature in database
6 changed files with 93 additions and 1 deletions

View file

@ -4,6 +4,31 @@ set -euo pipefail
repo_root="$(git rev-parse --show-toplevel)" repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root" cd "$repo_root"
if [[ "${NVE_SKIP_BUILD_NUMBER_BUMP:-0}" == "1" ]]; then
exit 0
fi
mapfile -t staged_files < <(git diff --cached --name-only --diff-filter=ACMR)
if (( ${#staged_files[@]} == 0 )); then
exit 0
fi
docs_only_commit=1
for path in "${staged_files[@]}"; do
case "$path" in
README.md|CHANGELOG.md|docs/*|.github/*|scripts/*|.githooks/*)
;;
*)
docs_only_commit=0
break
;;
esac
done
if [[ "$docs_only_commit" -eq 1 ]]; then
exit 0
fi
if [[ -x "scripts/bump_build_number.sh" ]]; then if [[ -x "scripts/bump_build_number.sh" ]]; then
scripts/bump_build_number.sh scripts/bump_build_number.sh
git add "Neon Vision Editor.xcodeproj/project.pbxproj" git add "Neon Vision Editor.xcodeproj/project.pbxproj"

View file

@ -3,8 +3,16 @@ name: Pre-release CI
on: on:
push: push:
branches: ["main"] branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "docs/**"
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "docs/**"
permissions: permissions:
contents: read contents: read

View file

@ -119,6 +119,47 @@ retry_cmd() {
done done
} }
release_exists_and_is_published() {
local tag_name="$1"
local is_draft
if ! gh release view "$tag_name" >/dev/null 2>&1; then
return 1
fi
is_draft="$(gh release view "$tag_name" --json isDraft --jq '.isDraft' 2>/dev/null || echo "false")"
[[ "$is_draft" != "true" ]]
}
refresh_download_metrics_if_needed() {
local tag_name="$1"
if ! step_enabled prep; then
return 0
fi
if ! release_exists_and_is_published "$tag_name"; then
return 0
fi
echo "Checking README download metrics freshness for published release ${tag_name}..."
if scripts/update_download_metrics.py --check --require-traffic-api; then
return 0
fi
echo "Refreshing stale download metrics before release preflight..."
scripts/update_download_metrics.py
git add README.md docs/images/release-download-trend.svg
if git diff --cached --quiet; then
echo "Download metrics refresh produced no staged changes."
return 0
fi
NVE_SKIP_BUILD_NUMBER_BUMP=1 git commit -m "chore(release): refresh download metrics for ${tag_name}"
echo "Committed refreshed download metrics for ${tag_name}."
}
while [[ "${1:-}" != "" ]]; do while [[ "${1:-}" != "" ]]; do
case "$1" in case "$1" in
notarized|--notarized) notarized|--notarized)
@ -401,6 +442,8 @@ if [[ "$REQUIRES_CLEAN_TREE" -eq 1 && "$AUTOSTASH" -eq 0 && -n "$(git status --p
exit 1 exit 1
fi fi
refresh_download_metrics_if_needed "$TAG"
if step_enabled docs; then if step_enabled docs; then
echo "Verifying release docs are up to date for ${TAG}..." echo "Verifying release docs are up to date for ${TAG}..."
docs_check_cmd=(scripts/prepare_release_docs.py "$TAG" --check) docs_check_cmd=(scripts/prepare_release_docs.py "$TAG" --check)

View file

@ -142,7 +142,7 @@ if git diff --cached --quiet; then
echo "No release metadata/docs changes to commit." echo "No release metadata/docs changes to commit."
else else
COMMIT_MSG="chore(release): prepare ${TAG}" COMMIT_MSG="chore(release): prepare ${TAG}"
git commit -m "$COMMIT_MSG" NVE_SKIP_BUILD_NUMBER_BUMP=1 git commit -m "$COMMIT_MSG"
echo "Created commit: $COMMIT_MSG" echo "Created commit: $COMMIT_MSG"
fi fi

View file

@ -3,8 +3,16 @@ name: Pre-release CI
on: on:
push: push:
branches: ["main"] branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "docs/**"
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "docs/**"
permissions: permissions:
contents: read contents: read

View file

@ -3,8 +3,16 @@ name: Pre-release CI
on: on:
push: push:
branches: ["main"] branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "docs/**"
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "docs/**"
permissions: permissions:
contents: read contents: read