Skip to content

fix: Fix deploy pipeline #23

fix: Fix deploy pipeline

fix: Fix deploy pipeline #23

name: Deploy PR Preview
on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
paths-ignore:
- '.docsearch/**'
- 'README.md'
- '.gitpod.yml'
workflow_dispatch:
env:
ALGOLIA_APP_ID: ${{secrets.ALGOLIA_APP_ID}}
ALGOLIA_KEY: ${{secrets.ALGOLIA_KEY}}
NO_INDEX: true
concurrency: preview-${{ github.ref }}
jobs:
deploy-pr-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x
- uses: actions/cache@v4
name: Cache NPM Packages
id: cache-npm-packages
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
- uses: actions/cache@v4
name: Cache Build
id: cache-build
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}
- name: Set preview path
run: echo "PREVIEW_PATH=sauce-docs/pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"
- name: Install Dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true' && github.event.action != 'closed' # Skip if the PR was closed
run: |
npm install
- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true' && github.event.action != 'closed' # Skip if the PR was closed
run: |
npm run build
- name: Deploy PR preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build/