Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
125 changes: 125 additions & 0 deletions .github/workflows/a-b-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Build & Deploy Docusaurus Site

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

workflow_dispatch:
inputs:
target:
description: "Deploy target"
required: true
default: "gh"
type: choice
options:
- gh
- dreamhost

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
name: Build site
runs-on: ubuntu-latest

outputs:
deploy_target: ${{ steps.set-target.outputs.target }}

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set deploy target
id: set-target
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "target=${{ inputs.target }}" >> $GITHUB_OUTPUT
else
echo "target=gh" >> $GITHUB_OUTPUT
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: website/package-lock.json

- name: Install dependencies
run: |
cd website
npm ci
- name: Build Docusaurus site
env:
DEPLOY_TARGET: ${{ steps.set-target.outputs.target }}
run: |
cd website
npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: docusaurus-build
path: website/build


deploy-gh-pages:
name: Deploy to GitHub Pages
needs: build
if: |
needs.build.outputs.deploy_target == 'gh' &&
github.event_name != 'pull_request'
runs-on: ubuntu-latest

environment:
name: github-pages

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: docusaurus-build
path: build

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4


deploy-dreamhost:
name: Deploy to DreamHost
needs: build
if: |
needs.build.outputs.deploy_target == 'dreamhost' &&
github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: docusaurus-build
path: build

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DREAMHOST_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.DREAMHOST_HOST }} >> ~/.ssh/known_hosts
- name: Deploy via rsync
run: |
rsync -avz --delete build/ \
${{ secrets.DREAMHOST_USER }}@${{ secrets.DREAMHOST_HOST }}:${{ secrets.DREAMHOST_PATH }}/
5 changes: 3 additions & 2 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ const config = {
baseUrl: siteConfig[deployTarget].baseUrl,
trailingSlash: false,

// 2026-02-20 Friday 11:02:52.No longer needed?
// For GitHub pages deployment:
organizationName: 'aboutcode-org',
projectName: 'www.aboutcode.org',
// organizationName: 'aboutcode-org',
// projectName: 'www.aboutcode.org',

onBrokenLinks: 'throw',
// 2026-02-11 Wednesday 10:26:31. The following is deprecated, to be removed in v4, replaced with similar structure above under 'markdown:'.
Expand Down