refactor: to simplify the judge #1808
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preview Build | |
on: | |
pull_request: | |
jobs: | |
build-preview: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install pnpm | |
id: pnpm-install | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- name: Setup pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run Build Script | |
run: | | |
pnpm build-doc | |
- run: | | |
zip -r dist.zip dist | |
- name: Upload dist artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist.zip | |
retention-days: 5 | |
- name: Save PR number | |
if: ${{ always() }} | |
run: echo ${{ github.event.number }} > ./pr-id.txt | |
- name: Upload PR number | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pr | |
path: ./pr-id.txt |