5050
5151# Get the current version from package.json
5252npm_previous_package_version=$( jq -r ' .version' ./packages/react-admin/package.json)
53+ # ${npm_previous_package_version%.*} extract the major.minor version
54+ npm_previous_package_minor_version=${npm_previous_package_version% .* }
5355
5456step " lerna version"
5557# Running lerna version
@@ -58,6 +60,8 @@ step "lerna version"
5860
5961# Get the version from package.json
6062npm_current_package_version=$( jq -r ' .version' ./packages/react-admin/package.json)
63+ # ${npm_current_package_version%.*} extract the major.minor version
64+ npm_current_package_minor_version=${npm_current_package_version% .* }
6165
6266# Remove the tag created by lerna
6367echo " Removing tag v${npm_current_package_version} created by lerna"
7074
7175if [ " ${npm_previous_package_version% .* } " != " ${npm_current_package_version% .* } " ]; then
7276 echo " New minor version - Updating the OldVersion.md file"
73- npm_previous_package_minor_version=${npm_previous_package_version% .* }
74- npm_current_package_minor_version=${npm_current_package_version% .* }
75- echo $npm_previous_package_minor_version
76- echo $npm_current_package_minor_version
7777 sed -i " s/^- \[v$npm_previous_package_minor_version \].*/- [v$npm_current_package_minor_version ](https:\/\/github.com\/marmelab\/react-admin\/blob\/master\/docs\/Admin.md)\n- [v$npm_previous_package_minor_version ](https:\/\/github\.com\/marmelab\/react\-admin\/blob\/v$npm_previous_package_version \/docs\/Admin.md\)/" docs/OldVersions.md
7878 if [ -z " $RELEASE_DRY_RUN " ]; then
7979 echo " Committing the OldVersion.md file update"
@@ -135,15 +135,14 @@ yarn run create-github-release ${npm_current_package_version}
135135step " Update the documentation"
136136if [ -d $RA_DOC_PATH ]; then
137137 ( cd $RA_DOC_PATH && git pull )
138- # ${npm_current_package_version%.*} extract the major.minor version
139- RA_DOC_PATH=" $RA_DOC_PATH " VERSION=" ${npm_current_package_version% .* } " ./scripts/copy-ra-oss-docs.sh
138+ RA_DOC_PATH=" $RA_DOC_PATH " VERSION=" $npm_current_package_minor_version " ./scripts/copy-ra-oss-docs.sh
140139 # Set the latest version in the versions.yml file
141140 echo " Update the latest version in the versions.yml file"
142141 sed -i " /^\(- latest\).*/s//\1 \($npm_current_package_version \)/" $RA_DOC_PATH /_data/versions.yml
143- if [ " ${npm_previous_package_version % . * } " != " ${npm_current_package_version % . * } " ]; then
142+ if [ " $npm_previous_package_minor_version " != " $npm_current_package_minor_version " ]; then
144143 echo " Add the previous minor version to the list of versions in the versions.yml file"
145144 # Add the previous minor version to the list of versions in the versions.yml file
146- sed -i " /^\(- latest.*\)/s//\1 \n- \" ${npm_previous_package_version % . * } \" /" $RA_DOC_PATH /_data/versions.yml
145+ sed -i " /^\(- latest.*\)/s//\1 \n- \" $npm_previous_package_minor_version \" /" $RA_DOC_PATH /_data/versions.yml
147146 fi
148147 if [ -z " $RELEASE_DRY_RUN " ]; then
149148 ( cd $RA_DOC_PATH && git add . && git commit -m " Update the documentation for version $npm_current_package_version " && git push )
0 commit comments