-
Notifications
You must be signed in to change notification settings - Fork 13
/
buildrelease.sh
executable file
·93 lines (77 loc) · 2.46 KB
/
buildrelease.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Script to perform a release build for all APIs tagged at
# a specific commit. A single argument is required: the commit to use.
# The repo is cloned into a fresh "releasebuild" directory.
set -e
# Additional arguments:
# --rebuild_docs: Just build the projects and docs, don't create nuget packages.
# Also, use the latest to pick up new docs changes rather than
# the commit of the tag.
# --skip_tests: Skip the integration tests
# --ssh: Use SSH to clone GitHub repos
rebuild_docs=false
run_tests=true
clone_path_prefix="https://github.com/"
commit=
while (( "$#" )); do
if [[ "$1" == "--rebuild_docs" ]]
then
rebuild_docs=true
elif [[ "$1" == "--skip_tests" ]]
then
run_tests=false
elif [[ "$1" == "--ssh" ]]
then
clone_path_prefix="[email protected]:"
else
commit=$1
fi
shift
done
if [ -z "$commit" ]
then
echo "Please specify a commit hash"
exit 1
fi
# Do everything from the repository root for sanity.
cd $(dirname $0)
rm -rf releasebuild
git clone ${clone_path_prefix}googleapis/dotnet-spanner-entity-framework.git releasebuild -c core.autocrlf=input --recursive
cd releasebuild
# See b/381899554
git config --global --add safe.directory C:/tmpfs/src/github/dotnet-spanner-entity-framework
# Make sure the package is deterministic. We don't do this for local builds,
# but it makes debugging work more reliably for PDBs in packages.
export DeterministicSourcePaths=true
if [[ "$rebuild_docs" = true ]]
then
git checkout master
else
git checkout $commit
fi
# Turn the multi-line output of git tag --points-at into space-separated list of projects
projects="Google.Cloud.EntityFrameworkCore.Spanner"
./build.sh $projects
# TODO: Figure out how to get the integration tests to run.
if [[ "$rebuild_docs" = false ]]
then
for project in $projects
do
# Don't pack the whole solution - just the project. (Avoids packing dependent
# projects such as Google.LongRunning.)
dotnet pack --no-build --no-restore -o $PWD/nuget -c Release $project
done
fi
# TODO: Use builddocs.sh to build docs.
echo "Release build and docs complete for the following projects:"
for project in $projects
do
echo "- ${project}"
done
if [[ "$rebuild_docs" = false ]]
then
echo "- Push packages to nuget:"
echo " - cd releasebuild/nuget"
echo " - Remove any packages you don't want to push"
echo " - for pkg in *.nupkg; do dotnet nuget push -s https://api.nuget.org/v3/index.json -k API_KEY_HERE \$pkg; done"
fi