Skip to content

Commit eac6ec6

Browse files
committed
github action for mkdocs
1 parent f569492 commit eac6ec6

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy Documentation to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow on push events to the main branch
5+
push:
6+
branches:
7+
- master
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read # Read access to checkout the code
14+
pages: write # Write access to deploy to Pages
15+
id-token: write # Needed for OIDC token if using advanced deployment methods
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
# If you have git-submodules
31+
# with:
32+
# submodules: recursive
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: 3.x # Use a recent Python 3 version
38+
cache: 'pip' # Cache pip dependencies
39+
40+
- name: Install dependencies
41+
run: pip install mkdocs mkdocs-material # Add any other mkdocs plugins here
42+
43+
# --- !!! ---
44+
# Add steps here to generate automatic content if needed
45+
# Example:
46+
# - name: Generate Javadoc
47+
# run: |
48+
# echo "Running Javadoc generation..."
49+
# # Actual command to generate Javadoc into e.g., docs/reference/javadoc
50+
# mkdir -p docs/reference/javadoc
51+
# echo "<html><body>Generated Javadoc Placeholder</body></html>" > docs/reference/javadoc/index.html
52+
# --- !!! ---
53+
54+
- name: Build MkDocs site
55+
run: mkdocs build --verbose # Build into the 'site' directory
56+
57+
- name: Upload artifact
58+
uses: actions/upload-pages-artifact@v3 # Use updated action
59+
with:
60+
# Upload entire site directory built by mkdocs
61+
path: './site'
62+
63+
# Deployment job
64+
deploy:
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }} # Output the deployed URL
68+
runs-on: ubuntu-latest
69+
needs: build # Run after the build job is successful
70+
steps:
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v4 # Use updated action for deployment

0 commit comments

Comments
 (0)