Skip to content

Commit 53dd9ce

Browse files
committed
fix(hack): remove unused dependency update function and improve tagging logic
1 parent d80bcf0 commit 53dd9ce

File tree

2 files changed

+8
-47
lines changed

2 files changed

+8
-47
lines changed

hack/lib.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
set -euo pipefail
44

5-
ROOT_MODULE=$(go list -m)
6-
7-
function set_root_dir {
8-
# shellcheck disable=SC2034
9-
ROOT_DIR=$(go list -f '{{.Dir}}' "${ROOT_MODULE}")
10-
}
11-
12-
set_root_dir
13-
145
#### Convenient IO methods #####
156
COLOR_RED='\033[0;31m'
167
COLOR_ORANGE='\033[0;33m'

hack/release_mod.sh

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
# Examples:
44

5-
# Update all dependencies to version vX.Y.Z
6-
# ./hack/release_mod.sh deps vX.Y.Z
7-
8-
# Add tags to all modules with version vX.Y.Z
5+
# Add tags to all submodules with version vX.Y.Z
96
# ./hack/release_mod.sh tags v0.1.0
107

118
set -euo pipefail
@@ -23,37 +20,6 @@ go mod tidy
2320

2421
dirs=$(find . -name "go.mod" -not -path "./docs/*" -exec dirname {} \;)
2522

26-
function deps() {
27-
log_info "Updating dependencies to version ${version}"
28-
log_info ""
29-
30-
for dir in ${dirs}; do
31-
(
32-
log_info "Processing ${dir}"
33-
34-
cd "${dir}"
35-
36-
go mod tidy
37-
38-
modules=$(go list -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' -m all)
39-
deps=$(echo "${modules}" | grep -E "${ROOT_MODULE}/.*" || true)
40-
41-
for dep in ${deps}; do
42-
go mod edit -require "${dep}@${version}"
43-
done
44-
45-
go mod tidy
46-
47-
cd "${ROOT_DIR}"
48-
49-
log_succ " Processed ${dir}"
50-
)
51-
done
52-
53-
log_succ ""
54-
log_succ "Dependencies updated, and commit them manually"
55-
}
56-
5723
function tags(){
5824
log_info "Adding tags to all modules with version ${version}"
5925
log_info ""
@@ -68,15 +34,19 @@ function tags(){
6834
prefix="${prefix}/"
6935
fi
7036

71-
tag="${prefix}${version}"
72-
git tag "${tag}"
37+
# if prefix is empty, it means it's just the root module, do not handle it
38+
if [ -n "${prefix}" ]; then
39+
tag="${prefix}${version}"
40+
git tag "${tag}"
7341

74-
log_succ " Tag ${tag}"
42+
log_succ " Tag ${tag}"
43+
fi
7544
)
7645
done
7746

7847
log_succ ""
7948
log_succ "Tags added, and push them manually"
49+
log_succ "Then tag main module with ${version}, and push it to trigger the release"
8050
}
8151

8252
# run the function

0 commit comments

Comments
 (0)