Link-Redirect-fix-DocsHelp-Component #492
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: Build Preview Deployment | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
# cancel in-progress runs on new commits to same PR (github.event.number) | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build-preview: | |
runs-on: ubuntu-latest | |
name: Build Preview Site and Upload Build Artifact | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Corepack enable | |
run: corepack enable | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Cache Node dependencies | |
uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Cache Next Build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build Site | |
run: yarn run build | |
env: | |
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ vars.NEXT_PUBLIC_ALGOLIA_APP_ID }} | |
NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ vars.NEXT_PUBLIC_ALGOLIA_API_KEY }} | |
# Uploads the build directory as a workflow artifact | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: preview-build | |
path: out |