|
1 | 1 | #!/bin/sh |
2 | 2 | # |
3 | 3 | # PairUX Pre-Push Hook |
4 | | -# Triggers the release process after push completes if a release trigger was detected. |
5 | 4 | # |
6 | | -# Flow: |
7 | | -# 1. User commits with "release:patch" in message |
8 | | -# 2. pre-commit runs tests → passes |
9 | | -# 3. commit-msg saves trigger to temp file |
10 | | -# 4. post-commit notifies user |
11 | | -# 5. User pushes |
12 | | -# 6. pre-push spawns background process and exits 0 (allows push) |
13 | | -# 7. Push completes |
14 | | -# 8. Background process runs release |
| 5 | +# The version bump and tagging now happen in the post-commit hook. |
| 6 | +# This hook just ensures a clean push. |
15 | 7 | # |
16 | 8 |
|
17 | | -# Colors for output |
18 | | -GREEN='\033[0;32m' |
19 | | -YELLOW='\033[1;33m' |
20 | | -BLUE='\033[0;34m' |
21 | | -NC='\033[0m' # No Color |
22 | | - |
23 | | -# Temp file from commit-msg hook |
24 | | -RELEASE_TRIGGER_FILE="/tmp/.pairux-release-trigger" |
25 | | - |
26 | | -# Check if a release was triggered |
27 | | -if [ -f "$RELEASE_TRIGGER_FILE" ]; then |
28 | | - RELEASE_TYPE=$(cat "$RELEASE_TRIGGER_FILE") |
29 | | - |
30 | | - echo "" |
31 | | - echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" |
32 | | - echo "${YELLOW}🚀 Release will run after push: ${RELEASE_TYPE}${NC}" |
33 | | - echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" |
34 | | - echo "" |
35 | | - |
36 | | - # Get the directory where the repo is located |
37 | | - REPO_DIR="$(git rev-parse --show-toplevel)" |
38 | | - |
39 | | - # Spawn a background process that waits for push to complete then runs release |
40 | | - ( |
41 | | - # Wait a moment for the push to complete |
42 | | - sleep 3 |
43 | | - |
44 | | - # Change to repo directory |
45 | | - cd "$REPO_DIR" || exit 1 |
46 | | - |
47 | | - # Check if trigger file still exists (wasn't cleaned up) |
48 | | - if [ -f "$RELEASE_TRIGGER_FILE" ]; then |
49 | | - RELEASE_TYPE=$(cat "$RELEASE_TRIGGER_FILE") |
50 | | - rm -f "$RELEASE_TRIGGER_FILE" |
51 | | - |
52 | | - echo "" |
53 | | - echo "${GREEN}✅ Push completed. Running release...${NC}" |
54 | | - echo "" |
55 | | - |
56 | | - # Run the release |
57 | | - pnpm release "$RELEASE_TYPE" |
58 | | - fi |
59 | | - ) & |
60 | | -fi |
61 | | - |
62 | 9 | # Always allow the push to proceed |
63 | 10 | exit 0 |
0 commit comments