File tree Expand file tree Collapse file tree 6 files changed +114
-683
lines changed
Expand file tree Collapse file tree 6 files changed +114
-683
lines changed Original file line number Diff line number Diff line change 66 - main
77 paths :
88 - ' docs/**'
9+ pull_request :
10+ paths :
11+ - ' docs/**'
912 workflow_dispatch :
1013
1114permissions :
2225 - uses : actions/checkout@v4
2326 - uses : actions/setup-node@v4
2427 with :
25- node-version : 18
28+ node-version : 20
2629 cache : npm
2730 cache-dependency-path : docs/package-lock.json
2831
3336 run : npm run build
3437
3538 - name : Deploy to GitHub Pages
39+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
3640 uses : peaceiris/actions-gh-pages@v3
3741 with :
3842 github_token : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ name : Deploy PR Preview
2+
3+ on :
4+ pull_request_target :
5+ types :
6+ - opened
7+ - reopened
8+ - synchronize
9+ - closed
10+ paths :
11+ - ' docs/**'
12+
13+ permissions :
14+ contents : write
15+ pull-requests : write
16+ issues : write
17+
18+ jobs :
19+ deploy-preview :
20+ runs-on : ubuntu-latest
21+ defaults :
22+ run :
23+ working-directory : docs
24+ steps :
25+ - uses : actions/checkout@v4
26+ with :
27+ ref : ${{ github.event.pull_request.head.sha }}
28+
29+ - uses : actions/setup-node@v4
30+ with :
31+ node-version : 20
32+ cache : npm
33+ cache-dependency-path : docs/package-lock.json
34+
35+ - name : Install dependencies
36+ run : npm ci
37+
38+ - name : Deploy preview
39+ uses : rossjrw/pr-preview-action@v1
40+ with :
41+ source_dir : docs/build
42+ preview_branch : gh-pages
43+ umbrella_dir : pr-preview
44+ action : auto
45+ # We need to build the site within the action context or before
46+ # rossjrw action can run a build command, but it's often easier to run the build ourselves
47+ # provided we can set the env var.
48+ # Actually, the action supports a 'build_script' input.
49+ build_script : npm run build
50+ # We need to pass the BASE_URL env var to the build script.
51+ # The action doesn't natively expose a way to inject env vars into the build_script
52+ # easily unless we wrap it or use the 'env' map at the step level.
53+ env :
54+ # The action calculates the preview URL. We need to construct the matching Base URL.
55+ # Default format is: /<umbrella_dir>/<pr_number>/
56+ # But we are deployed at /OpenGIN/. So it will be /OpenGIN/pr-preview/<pr_number>/
57+ BASE_URL : /OpenGIN/pr-preview/${{ github.event.number }}/
Original file line number Diff line number Diff line change 1+ 20
Original file line number Diff line number Diff line change @@ -14,13 +14,17 @@ const config = {
1414 tagline : 'Open General Information Network' ,
1515 favicon : 'img/opengin_blue.png' ,
1616
17+ // Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
18+ future : {
19+ v4 : true , // Improve compatibility with the upcoming Docusaurus v4
20+ } ,
1721
1822
1923 // Set the production url of your site here
2024 url : 'https://LDFLK.github.io' ,
2125 // Set the /<baseUrl>/ pathname under which your site is served
2226 // For GitHub pages deployment, it is often '/<projectName>/'
23- baseUrl : '/OpenGIN/' ,
27+ baseUrl : process . env . BASE_URL || '/OpenGIN/' ,
2428
2529 // GitHub pages deployment config.
2630 // If you aren't using GitHub pages, you don't need these.
You can’t perform that action at this time.
0 commit comments