Skip to content

Commit

Permalink
docs site: add PR previews
Browse files Browse the repository at this point in the history
  • Loading branch information
finn-block committed Jan 29, 2025
1 parent d65881b commit dc4c060
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 9 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/deploy-docs-and-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
push:
branches:
- main

pull_request:
paths:
- 'documentation/**'

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout the branch
Expand Down Expand Up @@ -47,10 +47,9 @@ jobs:
mkdir -p combined-build/v1/extensions
cp -r extensions-site/build/client/* combined-build/v1/extensions/
- name: Deploy to /gh-pages
uses: peaceiris/actions-gh-pages@v3
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: combined-build
destination_dir: . # Deploy the site to the root /goose directory

clean-exclude: pr-preview/
folder: combined-build
force: false
59 changes: 59 additions & 0 deletions .github/workflows/pr-website-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Documentation Site Preview

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
paths:
- 'documentation/**'

concurrency: preview-${{ github.ref }}

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the branch
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
if: github.event.action != 'closed'
with:
node-version: 20

- name: Install dependencies and build docs
working-directory: ./documentation
if: github.event.action != 'closed'
env:
INKEEP_API_KEY: ${{ secrets.INKEEP_API_KEY }}
INKEEP_INTEGRATION_ID: ${{ secrets.INKEEP_INTEGRATION_ID }}
INKEEP_ORG_ID: ${{ secrets.INKEEP_ORG_ID }}
TARGET_PATH: "/goose/pr-preview/pr-${{ github.event.number }}/"
run: |
npm install
npm run build
- name: Install dependencies and build extensions-site
working-directory: ./extensions-site
env:
VITE_BASENAME: "/goose/pr-preview/pr-${{ github.event.number }}/v1/extensions/" # Set the base URL here for the extensions site
run: |
npm install
npm run build
- name: Combine builds into one directory
run: |
mkdir combined-build
cp -r documentation/build/* combined-build/
mkdir -p combined-build/v1/extensions
cp -r extensions-site/build/client/* combined-build/v1/extensions/
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
if: ${{ github.event.pull_request.head.repo.full_name == 'block/goose' }}
with:
source-dir: combined-build
2 changes: 1 addition & 1 deletion documentation/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const config: Config = {
url: "https://block.github.io/",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/goose/",
baseUrl: process.env.TARGET_PATH || "/goose/",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
Expand Down

0 comments on commit dc4c060

Please sign in to comment.