-
-
Notifications
You must be signed in to change notification settings - Fork 253
/
prepare-release.sh
executable file
·47 lines (39 loc) · 1.52 KB
/
prepare-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
#! /usr/bin/env bash
#LICENSE Portions Copyright 2019-2021 ZomboDB, LLC.
#LICENSE
#LICENSE Portions Copyright 2021-2023 Technology Concepts & Design, Inc.
#LICENSE
#LICENSE Portions Copyright 2023-2023 PgCentral Foundation, Inc. <[email protected]>
#LICENSE
#LICENSE All rights reserved.
#LICENSE
#LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
NEW_VERSION=$1
if [ -z "${NEW_VERSION}" ]; then
echo "Usage: ./prepare-release.sh NEW_VERSION_NUMBER [base branch name]"
exit 1
fi
BASE_BRANCH=$2
if [ -z "${BASE_BRANCH}" ]; then
echo "using develop as the base branch"
BASE_BRANCH=develop
fi
git switch ${BASE_BRANCH} || exit $?
git fetch origin || exit $?
git diff origin/${BASE_BRANCH} | if [ "$0" = "" ]; then
echo "git diff found local changes on ${BASE_BRANCH} branch, cannot cut release."
elif [ "$NEW_VERSION" = "" ]; then
echo "No version set. Are you just copying and pasting this without checking?"
else
git pull origin ${BASE_BRANCH} --ff-only || exit $?
git switch -c "prepare-${NEW_VERSION}" || exit $?
cargo install --path cargo-pgrx --locked || exit $?
cargo pgrx init || exit $?
# exit early if the script fails
./update-versions.sh "${NEW_VERSION}" || exit $?
# sanity check the diffs, but not Cargo.lock files cuz ugh
# git diff -- . ':(exclude)Cargo.lock'
# send it all to github
git commit -a -m "Update version to ${NEW_VERSION}" || exit $?
git push --set-upstream origin "prepare-${NEW_VERSION}" || exit $?
fi