2021-09-14 19:37:14 +08:00
|
|
|
name: Website Preview
|
|
|
|
|
|
|
|
on: pull_request
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build
|
2021-12-10 18:18:16 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-09-17 00:18:50 +08:00
|
|
|
node-version: '16'
|
|
|
|
registry-url: https://registry.npmjs.com/
|
2021-09-14 19:37:14 +08:00
|
|
|
|
2021-09-23 08:12:37 +08:00
|
|
|
- name: Setup pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
2021-10-16 20:58:41 +08:00
|
|
|
version: latest
|
2021-09-14 19:37:14 +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
|
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
|
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'
|
2021-09-14 19:37:14 +08:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
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'
|
2021-09-14 19:37:14 +08:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: pr
|
|
|
|
path: ./pr.txt
|
|
|
|
retention-days: 1
|