Files
gemini-viewer-examples/.github/workflows/ci.yaml
2023-07-25 08:43:31 +08:00

56 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 当前 workflow 的名称
name: Gemini Viewer Build
# 指定 workflow 触发的 event
on:
push:
branches:
- main
# 一个 workflow 由一个或多个 job 组成
jobs:
# job id: 是 job 的唯一标识
build_and_deploy:
name: Build and Deploy
# job 运行的环境配置
runs-on: ubuntu-latest
# 一个 job 由多个 step 组成
steps:
# 当前 step 的名字
- name: Checkout
# checkout action 主要用于向 github 仓库拉取源代码
# https://github.com/actions/checkout
uses: actions/checkout@v2
with:
ref: main
- name: Cache
# cache 在这里主要用于缓存 npm提升构建速率
# https://github.com/actions/cache
uses: actions/cache@v2
# npm 缓存的路径可查看 https://docs.npmjs.com/cli/cache#cache
# 由于这里 runs-on 是 ubuntu-latest因此配置 ~/.npm
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18
- name: Build
run: |
npm install yarn -g
yarn
yarn build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
# Github 会在 workflow 中自动生成 GIHUBT_TOKEN用于认证 workflow 的运行
github_token: ${{ secrets.ACCESS_TOKEN }}
# 静态资源目录设置
publish_dir: ./build
# 默认发布到 gh-pages 分支上,可以指定特定的发布分支(不能选拉取代码的分支)
publish_branch: gh-pages
full_commit_message: ${{ github.event.head_commit.message }}