Skip to content

Commit 466f6ea

Browse files
committed
chore: update sonarcloud properties when releasing the project
1 parent eb91328 commit 466f6ea

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

scripts/pre-release.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ readonly DRY_RUN="${DRY_RUN:-true}"
1414
readonly CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1515
readonly ROOT_DIR="$(dirname "$CURRENT_DIR")"
1616
readonly MKDOCS_FILE="${ROOT_DIR}/mkdocs.yml"
17+
readonly SONARCLOUD_FILE="${ROOT_DIR}/sonar-project.properties"
1718
readonly VERSION_FILE="${ROOT_DIR}/internal/version.go"
1819

1920
readonly REPOSITORY="github.com/testcontainers/testcontainers-go"
@@ -27,11 +28,12 @@ function main() {
2728
bumpVersion "${version}"
2829
}
2930

30-
# This function is used to bump the version in the version.go file and in the mkdocs.yml file.
31+
# This function is used to bump the version in those files that refer to the project version.
3132
function bumpVersion() {
3233
local versionToBumpWithoutV="${1}"
3334
local versionToBump="v${versionToBumpWithoutV}"
3435

36+
# Bump version in the mkdocs descriptor file
3537
if [[ "${DRY_RUN}" == "true" ]]; then
3638
echo "sed \"s/latest_version: .*/latest_version: ${versionToBump}/g\" ${MKDOCS_FILE} > ${MKDOCS_FILE}.tmp"
3739
echo "mv ${MKDOCS_FILE}.tmp ${MKDOCS_FILE}"
@@ -40,6 +42,16 @@ function bumpVersion() {
4042
mv ${MKDOCS_FILE}.tmp ${MKDOCS_FILE}
4143
fi
4244

45+
# Bump version in the sonarcloud properties file
46+
if [[ "${DRY_RUN}" == "true" ]]; then
47+
echo "sed \"s/sonar\.projectVersion=.*/sonar\.projectVersion=${versionToBump}/g\" ${SONARCLOUD_FILE} > ${SONARCLOUD_FILE}.tmp"
48+
echo "mv ${SONARCLOUD_FILE}.tmp ${SONARCLOUD_FILE}"
49+
else
50+
sed "s/sonar\.projectVersion=.*/sonar\.projectVersion=${versionToBump}/g" ${SONARCLOUD_FILE} > ${SONARCLOUD_FILE}.tmp
51+
mv ${SONARCLOUD_FILE}.tmp ${SONARCLOUD_FILE}
52+
fi
53+
54+
# Bump version across all modules, in their go.mod files
4355
for directory in "${DIRECTORIES[@]}"
4456
do
4557
cd "${ROOT_DIR}/${directory}"
@@ -65,6 +77,7 @@ function bumpVersion() {
6577
NON_RELEASED_STRING='Not available until the next release of testcontainers-go <a href=\"https:\/\/github.com\/testcontainers\/testcontainers-go\"><span class=\"tc-version\">:material-tag: main<\/span><\/a>'
6678
RELEASED_STRING="Since testcontainers-go <a href=\\\"https:\/\/github.com\/testcontainers\/testcontainers-go\/releases\/tag\/v${versionEscapingDots}\\\"><span class=\\\"tc-version\\\">:material-tag: v${versionEscapingDots}<\/span><\/a>"
6779

80+
# Update the since-version in those modules that were added in the current version
6881
ls | grep -v "index.md" | while read -r module_file; do
6982
if [[ "${DRY_RUN}" == "true" ]]; then
7083
echo "sed \"s/${NON_RELEASED_STRING}/${RELEASED_STRING}/g\" ${module_file} > ${module_file}.tmp"

0 commit comments

Comments
 (0)