From e2e81805081612dbea376963cb96b71f735365f6 Mon Sep 17 00:00:00 2001 From: endiliey Date: Mon, 30 Jul 2018 18:58:08 +0800 Subject: [PATCH 01/10] chore: add prerelease script --- admin/prerelease.md | 15 ++++++++++++++ scripts/prerelease.sh | 47 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 admin/prerelease.md create mode 100644 scripts/prerelease.sh diff --git a/admin/prerelease.md b/admin/prerelease.md new file mode 100644 index 000000000000..39f7b9d3597a --- /dev/null +++ b/admin/prerelease.md @@ -0,0 +1,15 @@ +# Prereleasing New Version of Docusaurus + +[![asciicast](https://asciinema.org/a/n8rm53yfNURlIreGJkdSTgfAi.png)](https://asciinema.org/a/n8rm53yfNURlIreGJkdSTgfAi) + +# Steps + +1. Ensure that `origin` remote is your Docusaurus fork. Example + +```bash +$ git remote -v +origin https://github.com/endiliey/Docusaurus.git (fetch) +origin https://github.com/endiliey/Docusaurus.git (push) +``` + +1. Run `bash scripts/prerelease.sh` to create a pull request for new version release \ No newline at end of file diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh new file mode 100644 index 000000000000..35e1219ae6de --- /dev/null +++ b/scripts/prerelease.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +echo "Select a option to release (input a serial number):" +echo + +select VERSION in patch minor major "Specific Version" + do + echo + if [[ $REPLY =~ ^[1-4]$ ]]; then + if [[ $REPLY == 4 ]]; then + read -p "Enter a specific version: " -r VERSION + echo + if [[ -z $REPLY ]]; then + VERSION=$REPLY + fi + fi + + read -p "Release $VERSION - are you sure? (y/n) " -n 1 -r + echo + + if [[ $REPLY =~ ^[Yy]$ || -z $REPLY ]]; then + # bump version + yarn version --new-version $VERSION --no-git-tag-version + NEW_VERSION=$(node -p "require('./package.json').version") + + # create new branch + git checkout -b $NEW_VERSION master + + # cut docusaurus docs version + cd website && yarn run version $NEW_VERSION + + # Create PR + echo "Creating Pull Request for Release ${NEW_VERSION}" + git add . + git commit -m "v$NEW_VERSION" + git push origin $NEW_VERSION + echo "✅ Release PR created" + else + echo Cancelled + fi + break + else + echo Invalid \"${REPLY}\" + echo "To continue, please input a serial number(1-4) of an option." + echo + fi + done From 35cc1dc9e07d4a78f964c08c267b6abf9bcba47c Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 30 Jul 2018 16:22:50 -0700 Subject: [PATCH 02/10] Update prerelease.md --- admin/prerelease.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/prerelease.md b/admin/prerelease.md index 39f7b9d3597a..f741ca06522a 100644 --- a/admin/prerelease.md +++ b/admin/prerelease.md @@ -12,4 +12,4 @@ origin https://github.com/endiliey/Docusaurus.git (fetch) origin https://github.com/endiliey/Docusaurus.git (push) ``` -1. Run `bash scripts/prerelease.sh` to create a pull request for new version release \ No newline at end of file +2. Run `bash scripts/prerelease.sh` to create a pull request for release of new version. From 449f252ef9366f508a344b8fe16ed39525b42dda Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 30 Jul 2018 16:40:59 -0700 Subject: [PATCH 03/10] Update prerelease.sh --- scripts/prerelease.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh index 35e1219ae6de..d35141ef6892 100644 --- a/scripts/prerelease.sh +++ b/scripts/prerelease.sh @@ -1,9 +1,9 @@ #!/bin/bash -echo "Select a option to release (input a serial number):" +echo "Select an option for release:" echo -select VERSION in patch minor major "Specific Version" +select VERSION in Patch Minor Major "Specific Version" do echo if [[ $REPLY =~ ^[1-4]$ ]]; then @@ -41,7 +41,7 @@ select VERSION in patch minor major "Specific Version" break else echo Invalid \"${REPLY}\" - echo "To continue, please input a serial number(1-4) of an option." + echo "To continue, please enter one of the options (1-4):" echo fi done From dd46a49a0be20ae01112b3b0d7595fd74a81cc33 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 30 Jul 2018 16:48:22 -0700 Subject: [PATCH 04/10] Update prerelease.sh --- scripts/prerelease.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh index d35141ef6892..9ad875a0247d 100644 --- a/scripts/prerelease.sh +++ b/scripts/prerelease.sh @@ -3,7 +3,7 @@ echo "Select an option for release:" echo -select VERSION in Patch Minor Major "Specific Version" +select VERSION in patch minor major "Specific Version" do echo if [[ $REPLY =~ ^[1-4]$ ]]; then From 7e7ffa6aa2d0a270d726b83e9170335403dc3674 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 1 Aug 2018 14:09:56 +0800 Subject: [PATCH 05/10] chore: address review --- admin/prerelease.md | 8 +++++++- scripts/prerelease.sh | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/admin/prerelease.md b/admin/prerelease.md index f741ca06522a..9f77a7a3c8c6 100644 --- a/admin/prerelease.md +++ b/admin/prerelease.md @@ -12,4 +12,10 @@ origin https://github.com/endiliey/Docusaurus.git (fetch) origin https://github.com/endiliey/Docusaurus.git (push) ``` -2. Run `bash scripts/prerelease.sh` to create a pull request for release of new version. +2. Modify `CHANGELOG.md` and other necessary files. Do not commit yet. +3. Run `bash scripts/prerelease.sh` to create a commit for the new version pre-release. +4. Create your pull request on GitHub. + +Example: +pull request + diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh index 9ad875a0247d..8025c589dc3d 100644 --- a/scripts/prerelease.sh +++ b/scripts/prerelease.sh @@ -15,7 +15,7 @@ select VERSION in patch minor major "Specific Version" fi fi - read -p "Release $VERSION - are you sure? (y/n) " -n 1 -r + read -p "Submit a PR for a bump in $VERSION version - Are you sure ... (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ || -z $REPLY ]]; then From 059a3deff4953ce95f0d06e2f0391a44326a4200 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 1 Aug 2018 14:31:38 +0800 Subject: [PATCH 06/10] update instruction --- admin/prerelease.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/admin/prerelease.md b/admin/prerelease.md index 9f77a7a3c8c6..18e771fb0147 100644 --- a/admin/prerelease.md +++ b/admin/prerelease.md @@ -4,18 +4,24 @@ # Steps -1. Ensure that `origin` remote is your Docusaurus fork. Example +1. Ensure that `origin` remote is your Docusaurus fork and `upstream` is Docusaurus original repository. Example ```bash $ git remote -v origin https://github.com/endiliey/Docusaurus.git (fetch) origin https://github.com/endiliey/Docusaurus.git (push) +upstream https://github.com/facebook/Docusaurus.git (fetch) +upstream https://github.com/facebook/Docusaurus.git (push) +``` + +2. Pull latest change from Docusaurus repository + +```bash +$ git fetch upstream && git checkout master && git merge upstream/master ``` 2. Modify `CHANGELOG.md` and other necessary files. Do not commit yet. 3. Run `bash scripts/prerelease.sh` to create a commit for the new version pre-release. 4. Create your pull request on GitHub. -Example: -pull request - +pull request \ No newline at end of file From 11fa2db370f0cae60efd12781c84a310d13da9fc Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 1 Aug 2018 14:32:50 +0800 Subject: [PATCH 07/10] alias 'run version' to make it clear we're running docs version --- scripts/prerelease.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh index 8025c589dc3d..1c71b4f59f6d 100644 --- a/scripts/prerelease.sh +++ b/scripts/prerelease.sh @@ -1,5 +1,7 @@ #!/bin/bash +DOCS_VERSION_COMMAND="run version" + echo "Select an option for release:" echo @@ -27,7 +29,7 @@ select VERSION in patch minor major "Specific Version" git checkout -b $NEW_VERSION master # cut docusaurus docs version - cd website && yarn run version $NEW_VERSION + cd website && yarn $DOCS_VERSION_COMMAND $NEW_VERSION # Create PR echo "Creating Pull Request for Release ${NEW_VERSION}" From 6279e74f1a00781d07b2da04f6856de29194ee81 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 1 Aug 2018 14:35:54 +0800 Subject: [PATCH 08/10] indicate that we are creating commit, not pull request --- scripts/prerelease.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh index 1c71b4f59f6d..20268311900f 100644 --- a/scripts/prerelease.sh +++ b/scripts/prerelease.sh @@ -17,7 +17,7 @@ select VERSION in patch minor major "Specific Version" fi fi - read -p "Submit a PR for a bump in $VERSION version - Are you sure ... (y/n) " -n 1 -r + read -p "Create $VERSION commit - Are you sure ... (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ || -z $REPLY ]]; then @@ -31,8 +31,8 @@ select VERSION in patch minor major "Specific Version" # cut docusaurus docs version cd website && yarn $DOCS_VERSION_COMMAND $NEW_VERSION - # Create PR - echo "Creating Pull Request for Release ${NEW_VERSION}" + # Create commit + echo "Creating commit for v${NEW_VERSION}" git add . git commit -m "v$NEW_VERSION" git push origin $NEW_VERSION From 785cb8181728098447cb8b880b7ee615886b5a8d Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 1 Aug 2018 14:49:22 +0800 Subject: [PATCH 09/10] update asciinema preview --- admin/prerelease.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/prerelease.md b/admin/prerelease.md index 18e771fb0147..3a8ec5e8fa2a 100644 --- a/admin/prerelease.md +++ b/admin/prerelease.md @@ -1,6 +1,6 @@ # Prereleasing New Version of Docusaurus -[![asciicast](https://asciinema.org/a/n8rm53yfNURlIreGJkdSTgfAi.png)](https://asciinema.org/a/n8rm53yfNURlIreGJkdSTgfAi) +[![asciicast](https://asciinema.org/a/hZ7NNJPcgtdvzm5tMLLfHflMD.png)](https://asciinema.org/a/hZ7NNJPcgtdvzm5tMLLfHflMD) # Steps From e87969a930bbe30de657c49ce3b06298f2fb2a43 Mon Sep 17 00:00:00 2001 From: endiliey Date: Thu, 2 Aug 2018 01:08:43 +0800 Subject: [PATCH 10/10] nits --- admin/prerelease.md | 8 ++++---- scripts/prerelease.sh | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/admin/prerelease.md b/admin/prerelease.md index 3a8ec5e8fa2a..2027c9ef4634 100644 --- a/admin/prerelease.md +++ b/admin/prerelease.md @@ -4,7 +4,7 @@ # Steps -1. Ensure that `origin` remote is your Docusaurus fork and `upstream` is Docusaurus original repository. Example +1. Ensure that `origin` remote is your Docusaurus fork and `upstream` is Docusaurus original repository. ```bash $ git remote -v @@ -14,14 +14,14 @@ upstream https://github.com/facebook/Docusaurus.git (fetch) upstream https://github.com/facebook/Docusaurus.git (push) ``` -2. Pull latest change from Docusaurus repository +2. Pull latest changes from Docusaurus repository. ```bash $ git fetch upstream && git checkout master && git merge upstream/master ``` -2. Modify `CHANGELOG.md` and other necessary files. Do not commit yet. -3. Run `bash scripts/prerelease.sh` to create a commit for the new version pre-release. +2. Modify `CHANGELOG.md` and other necessary files. Do not commit the changes. +3. Run `bash scripts/prerelease.sh`. 4. Create your pull request on GitHub. pull request \ No newline at end of file diff --git a/scripts/prerelease.sh b/scripts/prerelease.sh index 20268311900f..d9cd9918dd46 100644 --- a/scripts/prerelease.sh +++ b/scripts/prerelease.sh @@ -32,11 +32,10 @@ select VERSION in patch minor major "Specific Version" cd website && yarn $DOCS_VERSION_COMMAND $NEW_VERSION # Create commit - echo "Creating commit for v${NEW_VERSION}" git add . git commit -m "v$NEW_VERSION" git push origin $NEW_VERSION - echo "✅ Release PR created" + echo "Finished" else echo Cancelled fi