Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 6s
Monorepo Pipeline / 🏗️ Build (push) Successful in 3m8s
Monorepo Pipeline / 🧪 Test (push) Successful in 4m16s
Monorepo Pipeline / 🧹 Lint (push) Successful in 5m34s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Image Processor (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
🏥 Server Maintenance / 🧹 Prune & Clean (push) Failing after 4s
46 lines
1.7 KiB
Plaintext
Executable File
46 lines
1.7 KiB
Plaintext
Executable File
# Validate Directus SDK imports before push
|
||
# This prevents runtime crashes caused by importing non-existent exports
|
||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||
if [ -f "$SCRIPT_DIR/scripts/validate-sdk-imports.sh" ]; then
|
||
"$SCRIPT_DIR/scripts/validate-sdk-imports.sh" || exit 1
|
||
fi
|
||
|
||
# Check if we are pushing a tag
|
||
while read local_ref local_sha remote_ref remote_sha
|
||
do
|
||
if [[ "$remote_ref" == refs/tags/* ]]; then
|
||
TAG=${remote_ref#refs/tags/}
|
||
echo "🏷️ Tag detected: $TAG, ensuring versions are synced..."
|
||
|
||
# Run sync script
|
||
pnpm sync-versions "$TAG"
|
||
|
||
# Check for changes in relevant files
|
||
SYNC_FILES="package.json packages/*/package.json apps/*/package.json .env.example"
|
||
CHANGES=$(git status --porcelain $SYNC_FILES)
|
||
|
||
if [[ -n "$CHANGES" ]]; then
|
||
echo "📝 Version sync made changes. Integrating into tag..."
|
||
|
||
# Stage and commit
|
||
git add $SYNC_FILES
|
||
git commit -m "chore: sync versions to $TAG" --no-verify
|
||
|
||
# Force update the local tag to point to the new commit
|
||
git tag -f "$TAG" > /dev/null
|
||
|
||
echo "✅ Tag $TAG has been updated locally with synced versions."
|
||
echo "🚀 Auto-pushing updated tag..."
|
||
|
||
# Push the updated tag directly (using --no-verify to avoid recursion)
|
||
git push origin "$TAG" --force --no-verify
|
||
|
||
echo "✨ Success! The hook synchronized the versions and pushed the updated tag for you."
|
||
echo "ℹ️ Note: The original push command was aborted in favor of the auto-push. This is normal."
|
||
exit 0 # Change to exit 0 to not show as an 'error' in vscode/terminal, though original push will still be technically 'failed' by git
|
||
else
|
||
echo "✨ Versions already in sync for $TAG."
|
||
fi
|
||
fi
|
||
done
|