forked from One-Block-Org/Atupa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·103 lines (85 loc) · 2.82 KB
/
Copy pathpublish.sh
File metadata and controls
executable file
·103 lines (85 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
# Atupa Workspace — Crates.io Publishing Script
#
# This script publishes all crates in the workspace in the required order.
# Usage: ./publish.sh [--dry-run]
# ─────────────────────────────────────────────────────────────────────────────
set -e
DRY_RUN=""
if [ "$1" == "--dry-run" ]; then
DRY_RUN="--dry-run"
echo "🔍 Performing DRY RUN..."
fi
# Robust publish function
publish_crate() {
local crate=$1
local delay=$2
echo "📦 Publishing $crate..."
# Run publish and capture output/exit status
set +e
output=$(cargo publish -p "$crate" $DRY_RUN 2>&1)
status=$?
set -e
if [ $status -eq 0 ]; then
echo "✅ Success: $crate"
elif echo "$output" | grep -q "already exists"; then
echo "⚠️ Already published: $crate"
else
echo "❌ FAILED: $crate"
echo "$output"
exit 1
fi
}
# Robust publish function with flags
publish_crate_with_flags() {
local crate=$1
local delay=$2
local flags=$3
echo "📦 Publishing $crate with flags [$flags]..."
# Run publish and capture output/exit status
set +e
output=$(cargo publish -p "$crate" $DRY_RUN $flags 2>&1)
status=$?
set -e
if [ $status -eq 0 ]; then
echo "✅ Success: $crate"
elif echo "$output" | grep -q "already exists"; then
echo "⚠️ Already published: $crate"
else
echo "❌ FAILED: $crate"
echo "$output"
exit 1
fi
if [ -n "$delay" ] && [ "$DRY_RUN" == "" ]; then
echo "⏳ Waiting ${delay}s for crates.io index..."
sleep "$delay"
fi
}
# 1. Foundation
publish_crate "atupa-core" 10
# 2. Level 1 - Independent / Base modules
publish_crate "atupa-rpc" 10
publish_crate "atupa-adapters" 10
# 3. Level 2 - Core Parsing & Visuals
publish_crate "atupa-parser" 10
publish_crate "atupa-output" 15
# 4. Level 3 - Protocol Adapters
publish_crate "atupa-aave" 10
publish_crate "atupa-lido" 10
publish_crate "atupa-nitro" 20
# 5. Facade SDK (Depends on adapters)
publish_crate "atupa-sdk" 30
# 6. Final Binary (Depends on everything)
echo "📦 Preparing studio assets for atupa binary..."
if [ -d "studio/dist" ]; then
rm -rf bin/atupa/dist
cp -r studio/dist bin/atupa/dist
else
echo "❌ Error: studio/dist not found. Run npm build first."
exit 1
fi
publish_crate_with_flags "atupa" 0 "--allow-dirty"
# Cleanup
rm -rf bin/atupa/dist
echo "✅ All crates processed successfully!"