2022-04-08 02:44:13 +08:00
|
|
|
name: PR Docs Build
|
2021-09-14 19:37:14 +08:00
|
|
|
|
|
|
|
on: pull_request
|
|
|
|
|
2022-06-25 22:18:54 +08:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-09-14 19:37:14 +08:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build
|
2021-12-10 18:18:16 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-05-10 00:46:13 +08:00
|
|
|
node-version: [16.x]
|
|
|
|
os: [ubuntu-latest, windows-latest]
|
2021-12-10 18:18:16 +08:00
|
|
|
fail-fast: false
|
|
|
|
|
2021-09-14 19:37:14 +08:00
|
|
|
env:
|
|
|
|
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
2021-12-10 18:18:16 +08:00
|
|
|
|
2021-09-14 19:37:14 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-07 10:52:16 +08:00
|
|
|
uses: actions/checkout@v3
|
2021-09-14 19:37:14 +08:00
|
|
|
|
2021-09-23 08:12:37 +08:00
|
|
|
- name: Setup pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
2021-09-14 19:37:14 +08:00
|
|
|
|
2022-05-10 00:46:13 +08:00
|
|
|
- name: Setup node
|
|
|
|
uses: actions/setup-node@v3
|
2022-02-21 16:11:17 +08:00
|
|
|
with:
|
2022-05-10 00:46:13 +08:00
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
cache: 'pnpm'
|
2022-02-21 16:11:17 +08:00
|
|
|
|
2021-09-23 08:12:37 +08:00
|
|
|
- name: Install dependencies
|
2021-10-16 20:58:41 +08:00
|
|
|
run: pnpm i --frozen-lockfile
|
2021-09-17 00:18:50 +08:00
|
|
|
|
|
|
|
- name: Generate common locale
|
2021-09-23 08:12:37 +08:00
|
|
|
run: pnpm docs:gen-locale
|
2021-09-17 00:18:50 +08:00
|
|
|
|
|
|
|
- name: Build Element Plus
|
2021-09-26 01:29:07 +08:00
|
|
|
run: pnpm build
|
2022-01-17 17:44:29 +08:00
|
|
|
env:
|
|
|
|
FORCE_COLOR: 2
|
2022-06-06 22:02:56 +08:00
|
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
2021-09-17 00:18:50 +08:00
|
|
|
|
2021-09-14 19:37:14 +08:00
|
|
|
- name: Build website
|
2021-09-23 08:12:37 +08:00
|
|
|
run: pnpm docs:build
|
2021-09-17 00:18:50 +08:00
|
|
|
env:
|
|
|
|
DOC_ENV: preview
|
2022-06-06 22:02:56 +08:00
|
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
2021-09-14 19:37:14 +08:00
|
|
|
|
2022-04-22 14:08:08 +08:00
|
|
|
- name: Move bundle to docs dist
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: mkdir docs/.vitepress/dist/bundle && mv dist/element-plus/dist/*.* docs/.vitepress/dist/bundle
|
|
|
|
|
2021-09-14 19:37:14 +08:00
|
|
|
# share website dist
|
|
|
|
- name: Upload artifact
|
2021-12-10 18:18:16 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2022-03-07 10:52:49 +08:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-09-14 19:37:14 +08:00
|
|
|
with:
|
2021-09-17 00:18:50 +08:00
|
|
|
name: docs
|
|
|
|
path: docs/.vitepress/dist/
|
2021-09-14 19:37:14 +08:00
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
# write pr.txt for share
|
|
|
|
- name: Save pr number
|
2021-12-10 18:18:16 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2021-09-14 19:37:14 +08:00
|
|
|
run: echo ${PULL_REQUEST_NUMBER} > ./pr.txt
|
|
|
|
|
|
|
|
# share pr number
|
|
|
|
- name: Upload pr number
|
2021-12-10 18:18:16 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2022-03-07 10:52:49 +08:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-09-14 19:37:14 +08:00
|
|
|
with:
|
|
|
|
name: pr
|
|
|
|
path: ./pr.txt
|
|
|
|
retention-days: 1
|