element-plus/.github/workflows/preview-build.yml

71 lines
1.5 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@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: https://registry.npmjs.com/
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- 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@v2
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@v2
with:
name: pr
path: ./pr.txt
retention-days: 1