[feat] gallery/build-an-elevator #121
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 is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build-and-deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# 拉取代码 | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# 拉取commit的深度,默认1,0表示拉取所有commit,会降低速度 | |
fetch-depth: 0 | |
# 安装NPM | |
- name: Install Dependencies | |
# You may pin to the exact commit or the version. | |
# uses: Jaid/action-npm-install@v1.2.4 | |
run: npm ci # clean install | |
# 生成静态文件 | |
- name: Build | |
run: npm run build | |
# 部署到 GitHub Pages | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} # 也就是我们刚才生成的 secret | |
BRANCH: gh-pages # 部署到 gh-pages 分支,因为 main 分支存放的一般是源码,而 gh-pages 分支则用来存放生成的静态文件 | |
FOLDER: docs/.vuepress/dist # vuepress 生成的静态文件存放的地方 |