Skip to content

Commit

Permalink
docs: add deploy guide for Netlify (#2264)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored May 5, 2024
1 parent bfa48be commit 4d2aaed
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
28 changes: 23 additions & 5 deletions website/docs/en/guide/basic/static-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ In this way, when referencing static assets in HTML, the specified prefix will b

## GitHub Pages

The following are step-by-step examples on how to deploy on GitHub Pages.
The following are step-by-step examples on how to deploy on [GitHub Pages](https://pages.github.com/).

1. Set the URL prefix for static assets through [output.assetPrefix](/config/output/asset-prefix).

Expand All @@ -91,10 +91,9 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
// Please replace <USERNAME> with the GitHub user or organization name where
// the repository is located, and replace <REPO_NAME> with the repository name.
// For example, https://jack.github.io/my-project/
assetPrefix: 'https://<USERNAME>.github.io/<REPO_NAME>/',
// Please replace <REPO_NAME> with the repository name.
// For example, "/my-project/"
assetPrefix: '/<REPO_NAME>/',
},
});
```
Expand Down Expand Up @@ -160,3 +159,22 @@ jobs:
```
5. Commit and wait for GitHub Actions to execute. Once it's done, you can visit `https://<USERNAME>.github.io/<REPO_NAME>/` to view the deployed page.

## Netlify

### Add New Site

Netlify provides a detailed guide, you can follow the instructions in [Netlify - Add new site](https://docs.netlify.com/welcome/add-new-site/), set up some basic information, and then you can start the deployment.

You need to configure the following two fields:

- **Build command**: fill in the build command of the project, it is typically `npm run build`.
- **Publish directory**: fill in the output directory in the project, the default is `dist`.

Then click on the **Deploy site** button to start the deployment.

### Custom Domains

If you want to make your sites accessible at your own domain names, you can configure it in the "Domain management" section of Netlify.

> The detailed guide: [Netlify - Custom domains](https://docs.netlify.com/domains-https/custom-domains/).
28 changes: 23 additions & 5 deletions website/docs/zh/guide/basic/static-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineConfig({

## GitHub Pages

下面是部署到 GitHub Pages 的步骤示例。
下面是部署到 [GitHub Pages](https://pages.github.com/) 的步骤示例。

1. 通过 [output.assetPrefix](/config/output/asset-prefix) 设置静态资源的 URL 前缀。

Expand All @@ -91,10 +91,9 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
// 请将 <USERNAME> 替换为仓库所在的 GitHub 用户或组织名称,
// 并将 <REPO_NAME> 替换为仓库的名称。
// 比如 https://jack.github.io/my-project/
assetPrefix: 'https://<USERNAME>.github.io/<REPO_NAME>/',
// 请将 <REPO_NAME> 替换为仓库的名称。
// 比如 "/my-project/"
assetPrefix: '/<REPO_NAME>/',
},
});
```
Expand Down Expand Up @@ -160,3 +159,22 @@ jobs:
```
5. 提交,等待 GitHub Actions 执行,执行完成后,你可以访问 `https://<USERNAME>.github.io/<REPO_NAME>/` 来查看部署后的页面。

## Netlify

### 新增站点

Netlify 提供了详细的指南,你可以按照 [Netlify - Add new site](https://docs.netlify.com/welcome/add-new-site/) 操作,配置一些基础信息,就可以开始部署了。

你需要配置以下两个字段:

- **Build command**:构建命令,填写项目的 build 命令即可,通常是 `npm run build`。
- **Publish directory**:产物目录,填写项目中的产物目录,默认是 `dist`。

然后点击 **Deploy site** 按钮,就可以开始部署了。

### 配置域名

如果你想要使你的站点可以通过你自己的域名访问,那么你可以在 Netlify 的 "Domain management" 栏目中进行配置。

> 详细指南:[Netlify - Custom domains](https://docs.netlify.com/domains-https/custom-domains/)。

0 comments on commit 4d2aaed

Please sign in to comment.