-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathupdate-versions.sh
executable file
·55 lines (44 loc) · 1.62 KB
/
update-versions.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
#! /usr/bin/env bash
# Portions Copyright 2019-2021 ZomboDB, LLC.
# Portions Copyright 2021-2022 Technology Concepts & Design, Inc.
# <support@tcdi.com>
#
# All rights reserved.
#
# Use of this source code is governed by the MIT license that can be found in
# the LICENSE file.
# requires:
# * ripgrep
if [ "x$1" == "x" ]; then
echo "usage: ./update-verions.sh <VERSION>"
exit 1
fi
set -ex
HEAD=$(git rev-parse HEAD)
VERSION=$1
CARGO_TOMLS_TO_SED=(
./pallocator/Cargo.toml
./postpanic/Cargo.toml
./std/Cargo.toml
)
DEPENDENCIES_TO_UPDATE=(
"pgx"
"pgx-tests"
"pgx-macros"
"pgx-pgx-sys"
"pgx-utils"
"cargo-pgx"
)
SEMVER_REGEX="(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"
for cargo_toml in ${CARGO_TOMLS_TO_SED[@]}; do
for dependency in ${DEPENDENCIES_TO_UPDATE[@]}; do
rg --passthru -N "(?P<prefix>^${dependency}.*\")(?P<pin>=?)${SEMVER_REGEX}(?P<postfix>\".*$)" -r "\${prefix}=${VERSION}\${postfix}" ${cargo_toml} > ${cargo_toml}.tmp || true
mv ${cargo_toml}.tmp ${cargo_toml}
done
done
# for cargo_toml in ${CARGO_TOMLS_TO_BUMP[@]}; do
# rg --passthru -N "(?P<prefix>^version = \")${SEMVER_REGEX}(?P<postfix>\"$)" -r "\${prefix}${VERSION}\${postfix}" ${cargo_toml} > ${cargo_toml}.tmp || true
# mv ${cargo_toml}.tmp ${cargo_toml}
# done
# cargo generate-lockfile
# PGX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE=1 cargo test --no-run --workspace --no-default-features --features "pg14"