Skip to content

Commit 0d86557

Browse files
authored
chore: Fixes new-version.sh to avoid accidentally overwriting version variables when calling breaking-changes script (#519)
1 parent 5601d34 commit 0d86557

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

internal/core/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package core
55
// For more information please see: https://github.com/mongodb/atlas-sdk-go/blob/main/docs/doc_1_concepts.md
66
const (
77
// SDK release tag version.
8-
Version = "v20241113005.0.0"
8+
Version = "v20250219001.0.0"
99
// Resource Version.
1010
Resource = "20250219"
1111
)

tools/releaser/scripts/breaking-changes.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,26 @@ set -eu
55
TARGET_BREAKING_CHANGES_FILE=${TARGET_BREAKING_CHANGES_FILE:-""}
66
script_path=$(dirname "$0")
77

8-
# shellcheck source=/dev/null
9-
source "$script_path/extract-version.sh"
10-
BASE_VERSION="github.com/mongodb/atlas-sdk-go/$SDK_MAJOR_VERSION@$SDK_VERSION"
8+
baseVersion() {
9+
local base_version
10+
# Create an isolated subshell to contain the sourcing to avoid overwritting version vars
11+
base_version=$(
12+
{
13+
# shellcheck source=/dev/null
14+
source "$script_path/extract-version.sh" >&2
15+
# Output only the variable we want
16+
echo "github.com/mongodb/atlas-sdk-go/$SDK_MAJOR_VERSION@$SDK_VERSION"
17+
}
18+
)
19+
local ret_val=$?
20+
if [ $ret_val -ne 0 ]; then
21+
echo "Error when sourcing extract-version.sh" >&2
22+
return $ret_val
23+
fi
24+
export BASE_VERSION="$base_version"
25+
}
26+
27+
baseVersion
1128

1229
echo "Installing gorelease"
1330
go install golang.org/x/exp/cmd/gorelease@latest >/dev/null

0 commit comments

Comments
 (0)