Skip to content

Commit 4289b62

Browse files
committed
Make some changes on the update dependencies script
1 parent eb9b737 commit 4289b62

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

update-dependencies.sh

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ abort() {
77
exit 1
88
}
99

10+
remote_checks_enabled() {
11+
[ "${LASO_SKIP_REMOTE_CHECKS:-0}" != "1" ]
12+
}
13+
1014
require_clean_worktree() {
1115
if ! git diff --quiet || ! git diff --cached --quiet; then
1216
abort "Working tree is not clean. Commit or stash your changes before running the release script."
@@ -27,8 +31,15 @@ require_main_branch() {
2731
}
2832

2933
require_up_to_date_main() {
34+
if ! remote_checks_enabled; then
35+
echo "Skipping remote main check because LASO_SKIP_REMOTE_CHECKS=1"
36+
return
37+
fi
38+
3039
echo "Checking remote main branch..."
31-
git fetch origin main
40+
if ! git fetch origin main; then
41+
abort "Unable to fetch origin/main from $(git remote get-url origin). Verify network access, or rerun with LASO_SKIP_REMOTE_CHECKS=1 for a local-only release."
42+
fi
3243

3344
local local_head remote_head merge_base
3445
local_head=$(git rev-parse HEAD)
@@ -74,13 +85,24 @@ compute_next_version() {
7485

7586
ensure_tag_available() {
7687
local tag=$1
88+
local remote_tag_status=0
7789

7890
if git rev-parse "$tag" >/dev/null 2>&1; then
7991
abort "Tag $tag already exists locally."
8092
fi
8193

82-
if git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null 2>&1; then
83-
abort "Tag $tag already exists on origin."
94+
if remote_checks_enabled; then
95+
git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null 2>&1 || remote_tag_status=$?
96+
97+
if [ "$remote_tag_status" -eq 0 ]; then
98+
abort "Tag $tag already exists on origin."
99+
fi
100+
101+
if [ "$remote_tag_status" -gt 1 ]; then
102+
abort "Unable to verify remote tags on origin. Verify network access, or rerun with LASO_SKIP_REMOTE_CHECKS=1 for a local-only release."
103+
fi
104+
else
105+
echo "Skipping remote tag check because LASO_SKIP_REMOTE_CHECKS=1"
84106
fi
85107
}
86108

@@ -166,5 +188,5 @@ echo "Step 8: Creating tag..."
166188
git tag -a "$TAG" -m "Release version $NEW_VERSION"
167189

168190
echo "Release complete: $TAG"
169-
echo "Push the release with:"
191+
echo "Push the release from your local machine with:"
170192
echo "git push origin main --follow-tags"

0 commit comments

Comments
 (0)