From cdfab94b53361fa4dd6af9d574b5fc663bf1ae8d Mon Sep 17 00:00:00 2001 From: Favour Kelvin <39309699+fakela@users.noreply.github.com> Date: Mon, 23 Mar 2020 04:51:23 +0100 Subject: [PATCH] docs(v2): suggest Surge for quick deployment (#2408) * docs(v2): suggest Surge for quick deployment * fixed typos * removed surge from version docs * Update getting-started-publishing.md * Update deployment.md * Update deployment.md * Update deployment.md * Update deployment.md Co-authored-by: Fakela Co-authored-by: Yangshun Tay --- website/docs/deployment.md | 50 +++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/website/docs/deployment.md b/website/docs/deployment.md index 14ffcfdab6..2f2c2e7b9a 100644 --- a/website/docs/deployment.md +++ b/website/docs/deployment.md @@ -11,7 +11,7 @@ npm run build Once it finishes, you should see the production build under the `build/` directory. -You can deploy your site to static site hosting services such as [ZEIT Now](https://zeit.co/now), [GitHub Pages](https://pages.github.com/), [Netlify](https://www.netlify.com/), and [Render](https://render.com/static-sites). Docusaurus sites are statically rendered so they work without JavaScript too! +You can deploy your site to static site hosting services such as [ZEIT Now](https://zeit.co/now), [GitHub Pages](https://pages.github.com/), [Netlify](https://www.netlify.com/), [Render](https://render.com/static-sites), and [Surge](https://surge.sh/help/getting-started-with-surge). Docusaurus sites are statically rendered so they work without JavaScript too! ## Deploying to ZEIT Now @@ -186,3 +186,51 @@ script: ``` Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script. + +## Deploying with Surge + +Surge is a [static web hosting platform](https://surge.sh/help/getting-started-with-surge), it is used to deploy your Docusaurus project from command line in a minute. Deploying your project to Surge is easy and it is also free (including a custom domain and SSL). + +Deploy your app in a matter of seconds using surge with the following steps: + +1. First, install Surge using npm by running the following command: + +```bash +npm install --g surge +``` + +2. To build the static files of your site for production in the root directory of your project, run: + +```bash +npm run build +``` + +3. Then, run this command inside the root directory of your project: + +```bash +surge build/ +``` + +First time users of Surge would be prompted to create an account from the command line(happens only once). + +Confirm that the site you want to publish is in the `build` directory, a randomly generated subdomain `*.surge.sh subdomain` is always given(which can be edited). + +### Using your domain + +If you have a domain name you can deploy your site using surge to your domain using the command: + +```bash +surge build/ yourdomain.com +``` + +You site is now deployed for free at `subdomain.surge.sh` or `yourdomain.com` depending on the method you chose. + +### Setting up CNAME file + +Store your domain in a CNAME file for future deployments with the following command: + +```bash +echo subdomain.surge.sh > CNAME +``` + +You can deploy any other changes in the future with the command `surge`.