mirror of
https://github.com/h3pdesign/Neon-Vision-Editor
synced 2026-04-21 13:27:16 +00:00
Stabilize release hooks and workflows
This commit is contained in:
parent
be8c07126d
commit
16d790021c
6 changed files with 93 additions and 1 deletions
|
|
@ -4,6 +4,31 @@ set -euo pipefail
|
|||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
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
|
||||
scripts/bump_build_number.sh
|
||||
git add "Neon Vision Editor.xcodeproj/project.pbxproj"
|
||||
|
|
|
|||
8
.github/workflows/pre-release-ci.yml
vendored
8
.github/workflows/pre-release-ci.yml
vendored
|
|
@ -3,8 +3,16 @@ name: Pre-release CI
|
|||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "CHANGELOG.md"
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "CHANGELOG.md"
|
||||
- "docs/**"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
|||
|
|
@ -119,6 +119,47 @@ retry_cmd() {
|
|||
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
|
||||
case "$1" in
|
||||
notarized|--notarized)
|
||||
|
|
@ -401,6 +442,8 @@ if [[ "$REQUIRES_CLEAN_TREE" -eq 1 && "$AUTOSTASH" -eq 0 && -n "$(git status --p
|
|||
exit 1
|
||||
fi
|
||||
|
||||
refresh_download_metrics_if_needed "$TAG"
|
||||
|
||||
if step_enabled docs; then
|
||||
echo "Verifying release docs are up to date for ${TAG}..."
|
||||
docs_check_cmd=(scripts/prepare_release_docs.py "$TAG" --check)
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ if git diff --cached --quiet; then
|
|||
echo "No release metadata/docs changes to commit."
|
||||
else
|
||||
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"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,16 @@ name: Pre-release CI
|
|||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "CHANGELOG.md"
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "CHANGELOG.md"
|
||||
- "docs/**"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
|||
|
|
@ -3,8 +3,16 @@ name: Pre-release CI
|
|||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "CHANGELOG.md"
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "CHANGELOG.md"
|
||||
- "docs/**"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
|||
Loading…
Reference in a new issue