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:
|
2022-09-22 09:04:40 +08:00
|
|
|
name: Build ${{ matrix.os }} ${{ matrix.node-name }}
|
2021-12-10 18:18:16 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-12-10 18:21:35 +08:00
|
|
|
node-version: [16]
|
2022-05-10 00:46:13 +08:00
|
|
|
os: [ubuntu-latest, windows-latest]
|
2022-09-22 09:04:40 +08:00
|
|
|
include:
|
|
|
|
- node-version: 16
|
|
|
|
node-name: LTS
|
2023-12-10 18:21:35 +08:00
|
|
|
# - node-version: 18
|
|
|
|
# node-name: Current
|
2022-09-22 09:04:40 +08:00
|
|
|
|
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 }}
|
2022-09-22 09:04:40 +08:00
|
|
|
|
|
|
|
- name: Get pnpm store directory
|
|
|
|
id: pnpm-cache
|
|
|
|
run: |
|
2022-10-27 15:17:05 +08:00
|
|
|
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
|
|
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT
|
2022-09-22 09:04:40 +08:00
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
name: Setup pnpm cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
|
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pnpm-store-
|
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
|