Skip to content

Commit 877ff2e

Browse files
committed
Added: Additional Settings for Pages Publishing, etc.
1 parent 1027977 commit 877ff2e

3 files changed

Lines changed: 44 additions & 10 deletions

File tree

README.MD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ jobs:
4444
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/deploy-mkdocs-documentation@v1
4545
with:
4646
REQUIREMENTS: ./docs/requirements.txt
47+
PUBLISH_TO_PAGES: true
48+
CHECKOUT: true
49+
PRE_BUILD_SCRIPT: ./scripts/pre-build.sh
50+
PRE_BUILD_SHELL: bash
4751
```
4852
4953
## Setup
@@ -66,6 +70,10 @@ The action supports the following input parameters:
6670
- `MKDOCS_VERSION`: (Optional) The version of MkDocs to use. Defaults to `latest`. This corresponds to the version in the Python package index.
6771
- `REQUIREMENTS`: (Optional) The path to a `requirements.txt` file listing additional Python dependencies. Defaults to `./docs/requirements.txt`.
6872
- `CONFIG_FILE`: (Optional) The path to your MkDocs configuration file. Defaults to `mkdocs.yml` in the repository root.
73+
- `PUBLISH_TO_PAGES`: (Optional) Whether to publish the generated site to GitHub Pages. Defaults to `true`.
74+
- `CHECKOUT`: (Optional) Whether to perform a repository checkout before building the site. Defaults to `true`.
75+
- `PRE_BUILD_SCRIPT`: (Optional) The path to a pre-build script to run before building the site.
76+
- `PRE_BUILD_SHELL`: (Optional) The shell to use for running the pre-build script. Defaults to `bash`.
6977

7078
### Workflow Triggers
7179

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

action.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,40 @@ inputs:
1616
required: false
1717
default: "mkdocs.yml"
1818
description: "Path to the mkdocs.yml file"
19+
PUBLISH_TO_PAGES:
20+
type: boolean
21+
required: false
22+
default: true
23+
description: "Whether to publish to GitHub Pages"
24+
CHECKOUT:
25+
type: boolean
26+
required: false
27+
default: true
28+
description: "Whether to perform repository checkout"
29+
PRE_BUILD_SCRIPT:
30+
type: string
31+
required: false
32+
description: "Path to the pre-build script"
33+
PRE_BUILD_SHELL:
34+
type: string
35+
required: false
36+
default: "bash"
37+
description: "Shell to use for running the pre-build script"
1938

2039
runs:
2140
using: "composite"
2241
steps:
23-
- uses: actions/checkout@v4
42+
- name: Checkout Repository
43+
if: ${{ inputs.CHECKOUT }}
44+
uses: actions/checkout@v4
2445
with:
2546
submodules: "recursive"
2647

2748
- name: Setup Pages
49+
if: ${{ inputs.PUBLISH_TO_PAGES }}
2850
id: pages
2951
uses: actions/configure-pages@v4
3052

31-
- name: Setup Python
32-
uses: actions/setup-python@v5
33-
with:
34-
python-version: 3.x
35-
3653
- name: Install MkDocs and Dependencies
3754
shell: bash
3855
run: |
@@ -42,21 +59,31 @@ runs:
4259
else
4360
pip install mkdocs-material==${{ inputs.MKDOCS_VERSION }}
4461
fi
45-
if [ -f ${{ inputs.REQUIREMENTS }} ]; then
46-
pip install -r ${{ inputs.REQUIREMENTS }}
62+
if [ -f "${{ inputs.REQUIREMENTS }}" ]; then
63+
pip install -r "${{ inputs.REQUIREMENTS }}"
64+
fi
65+
66+
- name: Run Pre-build Script
67+
if: ${{ inputs.PRE_BUILD_SCRIPT }}
68+
shell: ${{ inputs.PRE_BUILD_SHELL }}
69+
run: |
70+
if [ -f "${{ inputs.PRE_BUILD_SCRIPT }}" ]; then
71+
${{ inputs.PRE_BUILD_SHELL }} "${{ inputs.PRE_BUILD_SCRIPT }}"
4772
fi
4873
4974
- name: Build MkDocs Site
5075
shell: bash
51-
run: mkdocs build --config-file ${{ inputs.CONFIG_FILE }}
76+
run: mkdocs build --config-file "${{ inputs.CONFIG_FILE }}"
5277

5378
- name: Upload pages artifact
79+
if: ${{ inputs.PUBLISH_TO_PAGES }}
5480
uses: actions/upload-pages-artifact@v3
5581
with:
5682
name: "github-pages"
5783
path: "./site"
5884

5985
- name: Deploy to GitHub Pages
86+
if: ${{ inputs.PUBLISH_TO_PAGES }}
6087
id: deployment
6188
uses: actions/deploy-pages@v4
6289
with:

0 commit comments

Comments
 (0)