Skip to content

Commit 8c9a9d9

Browse files
authored
Merge pull request #211 from HarperDB/gh-pages-workflow
add gh pages template from docusaurus
2 parents ad823ce + 4b84891 commit 8c9a9d9

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Deploy Docusaurus to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow on pull requests and pushes to specific branches
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
- docs-in-hdb
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
14+
# However, do NOT cancel in-progress runs as we want to allow these deployments to complete.
15+
# This shouldn't be necessary for most cases, but it can help avoid conflicts if multiple pushes happen in quick succession.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
name: Build Docusaurus
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: '22'
32+
cache: 'npm'
33+
cache-dependency-path: 'package-lock.json'
34+
35+
- name: Debug - Show directory structure
36+
run: |
37+
echo "Current directory: $(pwd)"
38+
echo "Repository root contents:"
39+
ls -la
40+
echo "Site directory contents:"
41+
ls -la site/ || echo "Site directory not found"
42+
echo "Looking for package.json files:"
43+
find . -name "package.json" -type f
44+
45+
- name: Install root dependencies
46+
run: |
47+
echo "Installing root dependencies from $(pwd)"
48+
npm ci || (echo "Root npm ci failed, uploading logs" && exit 1)
49+
50+
- name: Install site dependencies
51+
run: |
52+
echo "Installing site dependencies..."
53+
npm run site:install || (echo "Site install failed" && exit 1)
54+
55+
- name: Build Docusaurus site
56+
run: |
57+
echo "Building Docusaurus site..."
58+
npm run site:build || (echo "Site build failed" && exit 1)
59+
60+
- name: Upload npm logs on failure
61+
if: failure()
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: npm-logs
65+
path: |
66+
~/.npm/_logs/
67+
68+
- name: Upload Build Artifact
69+
uses: actions/upload-pages-artifact@v3
70+
with:
71+
path: site/build
72+
73+
deploy:
74+
needs: build
75+
name: Deploy to GitHub Pages
76+
runs-on: ubuntu-latest
77+
# Only deploy on push to specific branches, not on PRs
78+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docs-in-hdb')
79+
80+
permissions:
81+
pages: write
82+
id-token: write
83+
84+
environment:
85+
name: github-pages
86+
url: ${{ steps.deployment.outputs.page_url }}
87+
88+
89+
steps:
90+
- name: Deploy to GitHub Pages
91+
id: deployment
92+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)