Skip to content

Commit 42e97cf

Browse files
authored
Merge pull request marmelab#10643 from marmelab/improve-release-script-old-version-doc
Improve release script old version doc
2 parents 5032e72 + f5788e7 commit 42e97cf

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

docs/OldVersions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You have two options to read them:
1414

1515
## v5
1616

17-
- [v5.7](https://github.com/marmelab/react-admin/blob/next/docs/Admin.md)
17+
- [v5.7](https://github.com/marmelab/react-admin/blob/master/docs/Admin.md)
1818
- [v5.6](https://github.com/marmelab/react-admin/blob/v5.6.4/docs/Admin.md)
1919
- [v5.5](https://github.com/marmelab/react-admin/blob/v5.5.4/docs/Admin.md)
2020
- [v5.4](https://github.com/marmelab/react-admin/blob/v5.4.4/docs/Admin.md)

scripts/release.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,10 @@ echo "Test the 3 demos (simple, e-commerce, crm): check console & UI"
4848
echo "Press Enter when this is done"
4949
read
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
5752
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%.*}
5855

5956
step "lerna version"
6057
# Running lerna version
@@ -63,6 +60,8 @@ step "lerna version"
6360

6461
# Get the version from package.json
6562
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%.*}
6665

6766
# Remove the tag created by lerna
6867
echo "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
7473
fi
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}
128135
step "Update the documentation"
129136
if [ -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

Comments
 (0)