Deployment
Valaxy 的部署非常简单,我们推荐你直接通过第三方的 CI 构建并托管到任意平台。
Deploying Valaxy is very easy. We suggest that you build and deploy to any platform using third party CI.
自行部署
Manual Deployment
# 构建打包
npm run build
# dist 文件夹为构建后的内容
# Build the package
npm run build
# The `dist/` directory contains the artifact
第三方部署
Third Party Deployment
GitHub Pages
在使用 pnpm create valaxy
创建模版项目时,已内置文件.github/workflows/gh-pages.yml
以实现 GitHub Actions 的自动部署工作流。
- 选择 Github Repo,打开
Settings
->Action
->General
->Workflow permissions
,选择read and write permissions
。 - 上传至 GitHub Repo,打开
Settings
->Pages
,选择gh-pages
分支。
gh-pages
已由.github/workflows/gh-pages.yml
自动部署。
注意修改
gh-pages.yml
中的on.push.branches
为你源代码所在的分支,默认为main
。
When you use pnpm create valaxy
to create a template project, it contains the file .github/workflows/gh-pages.yml
for the CI workflow of GitHub Actions.
- Select the Github repository, go to
Settings
->Action
->General
->Workflow permissions
, and selectread and write permissions
。 - Push to your GitHub repository, and go to
Settings
->Pages
. Selectgh-pages
branch.
gh-pages
has been automatically deployed by.github/workflows/gh-pages.yml
.
Please note that the 'on.push.branches' in’ gh-pages.yml’ should be modified to the branch where your source code is located, and the default is 'main'.
Netlify
已内置 netlify.toml
。
- 连接 GitHub 仓库,可自动部署。
netlify.toml
is built-in.
Vercel
对于已有的 Valaxy 博客,在开始部署之前,您需要先对您博客的 vercel.json
进行修改以便启用 cleanUrls
支持:
{
"cleanUrls": true
}
对于新创建的 Valaxy 博客,您只需要直接进行接下来的步骤即可。
- 在 Vercel 的 Dashboard 上,点击
Add New...
,随后点击Project
新建一个项目。 - 在左侧选择要部署的仓库,点击
Import
,随后将Framework Preset
设置为Other
并更改Build and Output Settings
。 - 将
Output Directory
设置为dist
后,点击Deploy
。 - 等待屏幕上撒下彩带后访问即可。
- On Vercel Dashboard, click
Add New...
, then clickProject
to create a project. - Select the repository you want to deploy and click
Import
and then setFramework Preset
toOther
and modifyBuild and Output Settings
. - Turn on the switch on the right of the textbox and type
dist
, clickDeploy
. - Wait for ribbons to drop on the screen, then visit your website.
Cloudflare Pages
- 登录你的 Cloudflare 账号,导航到 “Pages” 页面。
- 点击
创建项目
、连接到 Git
,选择你的 GitHub 或者 GitLab 仓库,并点击开始设置
。 - 选择你的部署分支。
- 将
构建命令
设置为npm run build
。 - 将
构建输出目录
设置为dist
后添加一个环境变量。
NODE_VERSION
:16
(设置 Node 版本)
- 点击
保存并部署
。
- Login to your Cloudflare account and navigate to "Pages" page.
- Click
Create a project
andConnect to Git
, then select your GitHub or GitLab repository and clickBegin setup
. - Select your Production branch.
- Set
Build output directory
tonpm run build
. - Set
Build output directory
todist
and add an environment variable.
NODE_VERSION
:16
(Set Node version)
- Then click "Save and Deploy".
其他
Others
你还可以使用 Render 等进行托管。
You can also use Render to host your website.
To Be Continued.