forked from stratum-mining/stratum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-versioning-lib-release.sh
executable file
·53 lines (47 loc) · 1.61 KB
/
check-versioning-lib-release.sh
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
#!/bin/bash
git fetch origin main
git fetch origin dev
crates=(
"utils/buffer"
"protocols/v2/binary-sv2/no-serde-sv2/derive_codec"
"protocols/v2/binary-sv2/no-serde-sv2/codec"
"protocols/v2/binary-sv2/serde-sv2"
"protocols/v2/binary-sv2/binary-sv2"
"protocols/v2/const-sv2"
"protocols/v2/framing-sv2"
"protocols/v2/noise-sv2"
"protocols/v2/codec-sv2"
"protocols/v2/subprotocols/common-messages"
"protocols/v2/subprotocols/job-declaration"
"protocols/v2/subprotocols/mining"
"protocols/v2/subprotocols/template-distribution"
"protocols/v2/sv2-ffi"
"protocols/v2/roles-logic-sv2"
"protocols/v1"
"utils/bip32-key-derivation"
"utils/error-handling"
"utils/key-utils"
"roles/roles-utils/network-helpers"
"roles/roles-utils/rpc"
"roles/jd-client"
"roles/jd-server"
"roles/mining-proxy"
"roles/pool"
"roles/translator"
)
# Loop through each crate
for crate in "${crates[@]}"; do
cd "$crate"
# Check if there were any changes between dev and main
git diff --quiet "origin/dev" "origin/main" -- .
if [ $? -ne 0 ]; then
# Check if crate versions on dev and main are identical
version_dev=$(git show origin/dev:./Cargo.toml | awk -F' = ' '$1 == "version" {gsub(/[ "]+/, "", $2); print $2}')
version_main=$(git show origin/main:./Cargo.toml | awk -F' = ' '$1 == "version" {gsub(/[ "]+/, "", $2); print $2}')
if [ "$version_dev" = "$version_main" ]; then
echo "Changes detected in crate $crate between dev and main branches! Versions on dev and main branches are identical ($version_dev), so you should bump the crate version on dev before merging into main."
exit 1
fi
fi
cd - >/dev/null
done