Skip to content

Commit 1d681da

Browse files
committed
Refactor and remove debug logs
1 parent ec723dc commit 1d681da

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

scripts/release.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ read
5050

5151
# Get the current version from package.json
5252
npm_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

5456
step "lerna version"
5557
# Running lerna version
@@ -58,6 +60,8 @@ step "lerna version"
5860

5961
# Get the version from package.json
6062
npm_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
6367
echo "Removing tag v${npm_current_package_version} created by lerna"
@@ -70,10 +74,6 @@ fi
7074

7175
if [ "${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}
135135
step "Update the documentation"
136136
if [ -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

Comments
 (0)