-
-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release v4.1.2
- Loading branch information
Showing
8 changed files
with
77 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,42 +64,60 @@ $ npm run preview | |
|
||
2. 在你的项目中,创建一个 `deploy.sh` 脚本,包含以下内容(注意高亮的行,按需使用),运行脚本来部署站点: | ||
|
||
```bash{16,24,27} | ||
#!/usr/bin/env sh | ||
# 发生错误时终止 | ||
set -e | ||
# 构建 | ||
npm run build | ||
# 进入构建文件夹 | ||
cd dist | ||
# 放置 .nojekyll 以绕过 Jekyll 的处理。 | ||
echo > .nojekyll | ||
# 如果你要部署到自定义域名 | ||
# echo 'www.example.com' > CNAME | ||
git init | ||
git checkout -B main | ||
git add -A | ||
git commit -m 'deploy' | ||
# 如果你要部署在 https://<USERNAME>.github.io | ||
# git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git main | ||
# 如果你要部署在 https://<USERNAME>.github.io/<REPO> | ||
# git push -f [email protected]:<USERNAME>/<REPO>.git main:gh-pages | ||
cd - | ||
```yml | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# 仅在推送到默认分支时运行。 | ||
push: | ||
branches: ['main'] | ||
|
||
# 这个选项可以使你手动在 Action tab 页面触发工作流 | ||
workflow_dispatch: | ||
|
||
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。 | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# 允许一个并发的部署 | ||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# 单次部署的工作描述 | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Build | ||
run: npm run build | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
# Upload dist repository | ||
path: './dist' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 | ||
``` | ||
::: tip | ||
你也可以在你的 CI 中配置该脚本,使得在每次推送代码时自动部署。 | ||
::: | ||
|
||
## GitLab Pages 配合 GitLab CI {#gitlab-pages-and-gitlab-ci} | ||
1. 在 `vite.config.js` 中设置正确的 `base`。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8920fbc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
cn-vitejs-dev – ./
docs-cn.vercel.app
cn-vitejs-dev-vuejs.vercel.app
cn-vitejs-dev-git-main-vuejs.vercel.app
cn.vitejs.dev