重写文档内容 #100
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
name: TEST_BUILD | |
on: | |
workflow_call: | |
pull_request: | |
branches: [next, main] | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node_version: | |
- 18 | |
steps: | |
- uses: actions/checkout@main | |
with: | |
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 | |
fetch-depth: 0 | |
- name: Set node version to ${{ matrix.node_version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Cache pnpm modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Install dependencies | |
uses: pnpm/action-setup@v2 | |
with: | |
run_install: true | |
# 构建 | |
- name: Build | |
run: pnpm site:preview | |
- run: | | |
zip -r _site.zip ./_dist | |
- name: upload _site artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: _site | |
path: _site.zip | |
retention-days: 5 | |
- name: Save PR number | |
if: ${{ always() }} | |
run: echo ${{ github.event.number }} > ./pr-id.txt | |
- name: Upload PR number | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pr | |
path: ./pr-id.txt |