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
|
2022-02-25 20:05:11 +08:00
|
|
|
uses: actions/setup-node@v3
|
2021-09-14 19:37:14 +08:00
|
|
|
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
|
|
|
|
2022-02-21 16:11:17 +08:00
|
|
|
- name: Cache ~/.pnpm-store
|
|
|
|
uses: actions/cache@v2
|
|
|
|
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 }}-
|
|
|
|
|
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
|
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
|