Skip to content

Commit ee74cee

Browse files
authored
SWIFT-1414 Update release script to not only work on main (#705)
1 parent 7698679 commit ee74cee

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

etc/build-examples.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ exit_code=0
44

55
examples=("BugReport" "Docs" "KituraExample" "PerfectExample" "VaporExample" "Atlas")
66

7+
branch=${1}
8+
# Ensure branch is non-empty
9+
[ ! -z "${branch}" ] || { echo "ERROR: Missing branch name"; exit 1; }
10+
711
for example_project in ${examples[@]}; do
812
echo "Building $example_project"
913
example_dir="Examples/${example_project}"
1014

11-
# replace version string with main
12-
etc/sed.sh -i 's/swift-driver", .upToNextMajor[^)]*)/swift-driver", .branch("main")/' "${example_dir}/Package.swift"
15+
# replace version string with release branch name
16+
etc/sed.sh -i "s/swift-driver\", .upToNextMajor[^)]*)/swift-driver\", .branch(\"${branch}\")/" "${example_dir}/Package.swift"
1317

1418
pushd "${example_dir}"
1519

@@ -32,6 +36,7 @@ for example_project in ${examples[@]}; do
3236
else
3337
echo "================= Building $example_project failed ================="
3438
exit_code=1
39+
exit "${exit_code}"
3540
fi
3641
done
3742

etc/release.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ version=${1}
99
# Ensure version is non-empty
1010
[ ! -z "${version}" ] || { echo "ERROR: Missing version string"; exit 1; }
1111

12-
# verify that the examples build
13-
./etc/build-examples.sh
12+
# verify that the examples build with the current branch we're releasing on
13+
current_branch=$(git branch --show-current)
14+
./etc/build-examples.sh ${current_branch}
1415

1516
# regenerate documentation with new version string
1617
./etc/generate-docs.sh ${version}
@@ -30,7 +31,7 @@ git commit -m "${version} docs"
3031
git push
3132

3233
# go back to our original branch
33-
git checkout -
34+
git checkout ${current_branch}
3435

3536
# update version string for libmongoc handshake
3637
sourcery --sources Sources/MongoSwift \

0 commit comments

Comments
 (0)