-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathrelease.sh
executable file
·59 lines (43 loc) · 1.59 KB
/
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
54
55
56
57
58
59
# usage: ./etc/release.sh [new version string]
# for example: ./etc/release.sh 1.0.0
# exit if any command fails
set -e
version=${1}
# Ensure version is non-empty
[ ! -z "${version}" ] || { echo "ERROR: Missing version string"; exit 1; }
# verify that the examples build with the current branch we're releasing on
current_branch=$(git branch --show-current)
./etc/build-examples.sh ${current_branch}
# regenerate documentation with new version string
./etc/generate-docs.sh ${version}
# commit/push docs to the gh-pages branch
git checkout gh-pages
rm -r docs/current
cp -r docs-temp docs/current
mv docs-temp docs/${version}
# build up documentation index
python3 ./_scripts/update-index.py
git add docs/
git commit -m "${version} docs"
git push
# go back to our original branch
git checkout ${current_branch}
# update version string for libmongoc handshake
sourcery --sources Sources/MongoSwift \
--templates Sources/MongoSwift/MongoSwiftVersion.stencil \
--output Sources/MongoSwift/MongoSwiftVersion.swift \
--args versionString=${version}
# update the README with the version string
etc/sed.sh -i "s/mongo-swift-driver\", .upToNextMajor[^)]*)/mongo-swift-driver\", .upToNextMajor(from: \"${version}\")/" README.md
# commit changes
git add Sources/MongoSwift/MongoSwiftVersion.swift
git add README.md
git commit -m "${version}"
# tag release
git tag "v${version}"
# push changes
git push
git push --tags
# go to GitHub to publish release notes
echo "Successfully tagged release! \
Go here to publish release notes: https://github.com/mongodb/mongo-swift-driver/releases/tag/v${version}"