This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create nodejs.yml that auto deploy to gh-pages branch
- Loading branch information
1 parent
0a7d943
commit 9be1024
Showing
1 changed file
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 当前工作流的名称 | ||
name: NextUI Node.js CI | ||
# ci触发的条件 | ||
on: | ||
push: # 什么请求触发 | ||
branches: | ||
- main # 作用在哪些分支上 | ||
workflow_dispatch: | ||
|
||
jobs: # 构建的任务,一个工作流有多个构建任务, | ||
page-deploy: | ||
runs-on: ubuntu-latest # 在什么服务器上面执行这些任务,这里使用最新版本的ubuntu | ||
permissions: | ||
contents: write | ||
|
||
steps: # 构建任务的步骤,一个任务可分为多个步骤 | ||
|
||
# 步骤1 拉取仓库代码 | ||
- name: 拉取代码 # 步骤名称 | ||
uses: actions/checkout@v2 | ||
|
||
# 步骤2 给当前服务器安装node | ||
- name: 安装 Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 # node版本 | ||
cache: "npm" | ||
|
||
# 步骤3 下载项目依赖 | ||
- name: 安装依赖项 | ||
run: npm install | ||
|
||
# 步骤4 打包node项目 | ||
- name: 构建项目 | ||
run: npm run build # 此处是你node项目的构建脚本 | ||
|
||
# 步骤5 部署项目 | ||
- name: 部署到 pages 分支 | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./build |