Skip to content

Commit

Permalink
build(): Adding PR previews #2
Browse files Browse the repository at this point in the history
  • Loading branch information
owilliams320 authored May 15, 2024
2 parents 5022a0f + 52a1765 commit 3c62be9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
workflow_dispatch:
pull_request:
types: [opened, edited, reopened, closed, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
- name: Install dependencies
run: npx ci
- name: Build docusaurus artifacts
env:
GH_PR_NUMBER: ${{ github.event.pull_request.number }}
run: npm run build -- --locale en --config ./docusaurus.config.ci.js
- name: PR Number
run: echo "PR-${{ github.event.pull_request.number }}"
- name: Deploy PR Preview
uses: rossjrw/pr-preview-action@v1
with:
token: ${{ secrets.GH_TOKEN }}
preview-branch: gh-pages
source-dir: ./build/
umbrella-dir: pr-preview
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
cache: npm
- name: Install dependencies
Expand Down
10 changes: 10 additions & 0 deletions docusaurus.config.ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import config from './docusaurus.config';

/** @type {import('@docusaurus/types').Config} */
const prConfig = {
...config,
noIndex: true,
baseUrl: `${config.baseUrl}/pr-preview/pr-${process.env.GH_PR_NUMBER}`
};

export default prConfig;

0 comments on commit 3c62be9

Please sign in to comment.