generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathrelease-prepare.sh
More file actions
34 lines (24 loc) · 1.25 KB
/
release-prepare.sh
File metadata and controls
34 lines (24 loc) · 1.25 KB
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
#!/bin/bash
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
set -e
VERSION=$1
MAJOR_VERSION=$(echo "$VERSION" | cut -d. -f1)
echo "Preparing release for version $VERSION (major: $MAJOR_VERSION)"
# Update Maven versions
mvn versions:set -DnewVersion="$VERSION" -DautoVersionSubmodules=true
# Portable sed for macOS and Linux
if [[ "$OSTYPE" == "darwin"* ]]; then
SED_CMD="sed -i ''"
else
SED_CMD="sed -i"
fi
# Update s3ec version in migration examples
$SED_CMD "s/<s3ec.version>.*<\/s3ec.version>/<s3ec.version>$VERSION<\/s3ec.version>/g" migration_examples/v3-to-v4/v4/pom.xml
# Update API_VERSION_UNKNOWN with major version
$SED_CMD "s/public static final String API_VERSION_UNKNOWN = \".*-unknown\"/public static final String API_VERSION_UNKNOWN = \"$MAJOR_VERSION-unknown\"/g" src/main/java/software/amazon/encryption/s3/internal/ApiNameVersion.java
# Update EXPECTED_API_MAJOR_VERSION
$SED_CMD "s/EXPECTED_API_MAJOR_VERSION = \"[0-9]*\"/EXPECTED_API_MAJOR_VERSION = \"$MAJOR_VERSION\"/g" src/test/java/software/amazon/encryption/s3/internal/ApiNameVersionTest.java
# Update version in README
$SED_CMD "s/<version>.*<\/version>/<version>$VERSION<\/version>/g" README.md
echo "Release preparation complete"