Skip to content

Commit

Permalink
Update README.md version update script (#1929)
Browse files Browse the repository at this point in the history
Merge readmes update script in update versions script, as they are related, depend on same versioning logic, during the release process always performed sequentially.
  • Loading branch information
vam-google authored Apr 17, 2017
1 parent d5a0d6c commit a27d8c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 72 deletions.
5 changes: 0 additions & 5 deletions utilities/stage_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ fi
./utilities/deploy.sh "$SITE_VERSION"

if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
# Update the versions on the docs
./utilities/update_readme_version.sh

git commit --quiet -m "Updating version in README files. [ci skip]"

# Create website
./utilities/create_site.sh "$SITE_VERSION"

Expand Down
33 changes: 0 additions & 33 deletions utilities/update_docs_version.sh

This file was deleted.

31 changes: 0 additions & 31 deletions utilities/update_readme_version.sh

This file was deleted.

29 changes: 26 additions & 3 deletions utilities/update_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Requires bash version >= 4.

# This script updates pom.xml and other relevant files to the next version number.
# This script updates pom.xml, README.md and other relevant files to the next version number.
# This script is meant to be run manually (not by Travis)

# Arguments (optional):
Expand Down Expand Up @@ -148,15 +148,38 @@ for item in ${modules[*]}; do
fi

echo -e "Updating module ${BOLD}${module}${NC} in folder ${folder} from version ${RED}${old_version}${NC} to ${GREEN}${new_version}${NC}"
module_suffix=${module##*-}

# Where the actual version changing happens (the only mutative operations in the script).
module_suffix=${module##*-}

# 1) Update version properties (used to define dependencies between google-cloud modules).
echo -e " Updating ${module_suffix}.version property in root pom.xml"
sed -ri "s/(<${module_suffix}.version>\s*)((\w|-|\.)+)(\s*<\/${module_suffix}.version>)/\1${new_version}\4/" pom.xml

# 2) Update version of the module. If the module is a parent of other modules
# (like the root module or the google-cloud-contrib), then the parent secion of its child modules
# will be updated too.
echo -e " Updating version in ${folder}\pom.xml and the parent version in the corresponding children modules if exist"
mvn -q versions:set -DartifactId=${module} -DnewVersion=${new_version} -DprocessPlugins=false -DgenerateBackupPoms=false

# 3) Update Google App Engine application dockerfile, if it exists.
if [ -w ${folder}/src/main/docker/Dockerfile ]; then
old_version="${module_version_map[${module}]}"
echo "Updating ${folder}/src/main/docker/Dockerfile"
echo -e " Updating ${folder}/src/main/docker/Dockerfile"
sed -ri "s/${old_version}/${new_version}/" ${folder}/src/main/docker/Dockerfile
fi

# 4) Update README.md
if [ "${new_snapshot}" == "" ] && [ -f ${folder}/README.md ]; then
echo -e " Updating ${folder}/README.md"
if [ "${module}" != "google-cloud-nio-examples" ]; then
sed -ri "s/<version>[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?<\/version>/<version>${new_version}<\/version>/g" ${folder}/README.md
sed -ri "s/:[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?'/:${new_version}'/g" ${folder}/README.md
sed -ri "s/\"[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?\"/\"${new_version}\"/g" ${folder}/README.md
else
examples_version=${new_base_version%.*}.$((${new_base_version##*.}+1))-alpha-SNAPSHOT
sed -ri "s/google-cloud-nio-[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?-SNAPSHOT/google-cloud-nio-${examples_version}/g" ${folder}/README.md
sed -ri "s/google-cloud-nio-examples-[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?-SNAPSHOT/google-cloud-nio-examples-${examples_version}/g" ${folder}/README.md
fi
fi
done

0 comments on commit a27d8c7

Please sign in to comment.