Skip to content

Commit d18f537

Browse files
authored
Merge pull request #137 from johnmhoran/85-add-baseurl-siteconfig
Add baseUrl siteConfig #85
2 parents e5e2581 + 6cc84a0 commit d18f537

3 files changed

Lines changed: 128 additions & 2 deletions

File tree

.github/workflows/a-b-deploy.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Build & Deploy Docusaurus Site
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
pull_request:
8+
branches: [ main ]
9+
10+
workflow_dispatch:
11+
inputs:
12+
target:
13+
description: "Deploy target"
14+
required: true
15+
default: "gh"
16+
type: choice
17+
options:
18+
- gh
19+
- dreamhost
20+
21+
permissions:
22+
contents: read
23+
pages: write
24+
id-token: write
25+
26+
jobs:
27+
build:
28+
name: Build site
29+
runs-on: ubuntu-latest
30+
31+
outputs:
32+
deploy_target: ${{ steps.set-target.outputs.target }}
33+
34+
steps:
35+
- name: Checkout repo
36+
uses: actions/checkout@v4
37+
38+
- name: Set deploy target
39+
id: set-target
40+
run: |
41+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
42+
echo "target=${{ inputs.target }}" >> $GITHUB_OUTPUT
43+
else
44+
echo "target=gh" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Setup Node
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 20
51+
cache: npm
52+
cache-dependency-path: website/package-lock.json
53+
54+
- name: Install dependencies
55+
run: |
56+
cd website
57+
npm ci
58+
59+
- name: Build Docusaurus site
60+
env:
61+
DEPLOY_TARGET: ${{ steps.set-target.outputs.target }}
62+
run: |
63+
cd website
64+
npm run build
65+
66+
- name: Upload build artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: docusaurus-build
70+
path: website/build
71+
72+
73+
deploy-gh-pages:
74+
name: Deploy to GitHub Pages
75+
needs: build
76+
if: |
77+
needs.build.outputs.deploy_target == 'gh' &&
78+
github.event_name != 'pull_request'
79+
runs-on: ubuntu-latest
80+
81+
environment:
82+
name: github-pages
83+
84+
steps:
85+
- name: Download build artifact
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: docusaurus-build
89+
path: build
90+
91+
- name: Upload Pages artifact
92+
uses: actions/upload-pages-artifact@v3
93+
with:
94+
path: build
95+
96+
- name: Deploy to GitHub Pages
97+
uses: actions/deploy-pages@v4
98+
99+
100+
deploy-dreamhost:
101+
name: Deploy to DreamHost
102+
needs: build
103+
if: |
104+
needs.build.outputs.deploy_target == 'dreamhost' &&
105+
github.event_name != 'pull_request'
106+
runs-on: ubuntu-latest
107+
108+
steps:
109+
- name: Download build artifact
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: docusaurus-build
113+
path: build
114+
115+
- name: Setup SSH
116+
run: |
117+
mkdir -p ~/.ssh
118+
echo "${{ secrets.DREAMHOST_SSH_KEY }}" > ~/.ssh/id_rsa
119+
chmod 600 ~/.ssh/id_rsa
120+
ssh-keyscan -H ${{ secrets.DREAMHOST_HOST }} >> ~/.ssh/known_hosts
121+
122+
- name: Deploy via rsync
123+
run: |
124+
rsync -avz --delete build/ \
125+
${{ secrets.DREAMHOST_USER }}@${{ secrets.DREAMHOST_HOST }}:${{ secrets.DREAMHOST_PATH }}/

website/docusaurus.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ const config = {
6666
baseUrl: siteConfig[deployTarget].baseUrl,
6767
trailingSlash: false,
6868

69+
// 2026-02-20 Friday 11:02:52.No longer needed?
6970
// For GitHub pages deployment:
70-
organizationName: 'aboutcode-org',
71-
projectName: 'www.aboutcode.org',
71+
// organizationName: 'aboutcode-org',
72+
// projectName: 'www.aboutcode.org',
7273

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

0 commit comments

Comments
 (0)