mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-04 12:17:37 +08:00
5f304a4940
Co-authored-by: Renovate Bot <bot@renovateapp.com>
83 lines
1.9 KiB
YAML
83 lines
1.9 KiB
YAML
name: Website Preview
|
|
|
|
on: pull_request
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
fail-fast: false
|
|
|
|
env:
|
|
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
registry-url: https://registry.npmjs.com/
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: latest
|
|
|
|
- name: Cache ~/.pnpm-store
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-pnpm-store
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ runner.os }}-preview-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-preview-${{ env.cache-name }}-
|
|
${{ runner.os }}-preview-
|
|
${{ runner.os }}-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i --frozen-lockfile
|
|
|
|
- name: Generate common locale
|
|
run: pnpm docs:gen-locale
|
|
|
|
- name: Build Element Plus
|
|
run: pnpm build
|
|
env:
|
|
FORCE_COLOR: 2
|
|
|
|
- name: Build website
|
|
run: pnpm docs:build
|
|
env:
|
|
DOC_ENV: preview
|
|
|
|
# share website dist
|
|
- name: Upload artifact
|
|
if: matrix.os == 'ubuntu-latest'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: docs
|
|
path: docs/.vitepress/dist/
|
|
retention-days: 1
|
|
|
|
# write pr.txt for share
|
|
- name: Save pr number
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: echo ${PULL_REQUEST_NUMBER} > ./pr.txt
|
|
|
|
# share pr number
|
|
- name: Upload pr number
|
|
if: matrix.os == 'ubuntu-latest'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: pr
|
|
path: ./pr.txt
|
|
retention-days: 1
|