@@ -48,13 +48,10 @@ echo "Test the 3 demos (simple, e-commerce, crm): check console & UI"
4848echo " Press Enter when this is done"
4949read
5050
51- step " manual task: Update the OldVersion.md file"
52- echo " [Minor version only] Update the ./docs/OldVersions.md file to add the new minor version and update the previous one && commit"
53- echo " Press Enter when this is done"
54- read
55-
5651# Get the current version from package.json
5752npm_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% .* }
5855
5956step " lerna version"
6057# Running lerna version
@@ -63,6 +60,8 @@ step "lerna version"
6360
6461# Get the version from package.json
6562npm_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% .* }
6665
6766# Remove the tag created by lerna
6867echo " Removing tag v${npm_current_package_version} created by lerna"
@@ -73,7 +72,15 @@ if [ ! -z "$RELEASE_DRY_RUN" ]; then
7372 git reset --soft HEAD~1
7473fi
7574
76- if [ " ${npm_previous_package_version% .* } " != " ${npm_current_package_version% .* } " ]; then
75+ if [ " $npm_previous_package_minor_version " != " $npm_current_package_minor_version " ]; then
76+ echo " New minor version - Updating the OldVersion.md file"
77+ 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
78+ if [ -z " $RELEASE_DRY_RUN " ]; then
79+ echo " Committing the OldVersion.md file update"
80+ git add .
81+ git commit -m " Update docs/OldVersion.md for version ${npm_current_package_version} "
82+ fi
83+
7784 echo " New minor version - Updating the dependencies to RA packages in the create-react-admin templates"
7885 yarn run update-create-react-admin-deps ${npm_current_package_version}
7986 if [ -z " $RELEASE_DRY_RUN " ]; then
@@ -128,15 +135,14 @@ yarn run create-github-release ${npm_current_package_version}
128135step " Update the documentation"
129136if [ -d $RA_DOC_PATH ]; then
130137 ( cd $RA_DOC_PATH && git pull )
131- # ${npm_current_package_version%.*} extract the major.minor version
132- 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
133139 # Set the latest version in the versions.yml file
134140 echo " Update the latest version in the versions.yml file"
135141 sed -i " /^\(- latest\).*/s//\1 \($npm_current_package_version \)/" $RA_DOC_PATH /_data/versions.yml
136- if [ " ${npm_previous_package_version % . * } " != " ${npm_current_package_version % . * } " ]; then
142+ if [ " $npm_previous_package_minor_version " != " $npm_current_package_minor_version " ]; then
137143 echo " Add the previous minor version to the list of versions in the versions.yml file"
138144 # Add the previous minor version to the list of versions in the versions.yml file
139- 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
140146 fi
141147 if [ -z " $RELEASE_DRY_RUN " ]; then
142148 ( cd $RA_DOC_PATH && git add . && git commit -m " Update the documentation for version $npm_current_package_version " && git push )
0 commit comments