element-plus/.github/workflows/preview-build.yml
2021-09-26 01:29:07 +08:00

61 lines
1.3 KiB
YAML

name: Website Preview
on: pull_request
jobs:
build:
name: Build
runs-on: ubuntu-latest
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: 6.15.1
- name: Install dependencies
run: pnpm i
- name: Generate common locale
run: pnpm docs:gen-locale
- name: Build Element Plus
run: pnpm build
- name: Build website
run: pnpm docs:build
env:
DOC_ENV: preview
# share website dist
- name: Upload artifact
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: ${{ always() }}
run: echo ${PULL_REQUEST_NUMBER} > ./pr.txt
# share pr number
- name: Upload pr number
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: pr
path: ./pr.txt
retention-days: 1