-
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.
Showing
3 changed files
with
59 additions
and
59 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 |
---|---|---|
@@ -1,39 +1,23 @@ | ||
name: Build and Package | ||
|
||
name: Deploy To Github pages | ||
permissions: | ||
contents: write | ||
on: | ||
push: | ||
branches: | ||
- main # 触发条件:当代码推送到主分支时触发 | ||
|
||
push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # 在 Ubuntu 环境下运行 | ||
|
||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 # 检出存储库代码 | ||
|
||
- name: Delete yarn.lock | ||
run: rm yarn.lock # 删除 yarn.lock 文件 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
node-version: 18 # 设置 Node.js 版本为 18.x | ||
|
||
- name: Install Dependencies | ||
run: yarn install # 使用 yarn 安装依赖 | ||
|
||
- name: Build | ||
run: yarn build # 运行构建命令 | ||
|
||
- name: Package Dist Folder | ||
persist-credentials: false | ||
- name: Install and Build | ||
run: | | ||
zip -r dist.zip dist # 将 dist 文件夹打包成 zip 文件 | ||
# mv dist.zip $GITHUB_WORKSPACE/dist.zip # 将 zip 文件移动到工作目录 | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
yarn | ||
yarn build | ||
- name: Deploy | ||
uses: JamesIves/[email protected] | ||
with: | ||
name: dist # 构建产物的名称 | ||
path: dist # 上传的文件路径 | ||
branch: gh-pages | ||
folder: dist | ||
|
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