ci: Modernize GitHub Actions workflow for documentation deployment
- Refactor deploy-docs.yml to use latest GitHub Pages deployment strategy - Add explicit permissions for GitHub Pages deployment - Separate build and deploy jobs for improved workflow clarity - Use actions/configure-pages and actions/deploy-pages for deployment - Implement concurrency control for deployment runs
This commit is contained in:
48
.github/workflows/deploy-docs.yml
vendored
48
.github/workflows/deploy-docs.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Deploy Documentation
|
name: Deploy Documentation
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -7,28 +8,53 @@ on:
|
|||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- 'mkdocs.yml'
|
- 'mkdocs.yml'
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
|
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r docs/requirements.txt
|
pip install -r docs/requirements.txt
|
||||||
- name: Configure Git
|
|
||||||
run: |
|
- name: Build documentation
|
||||||
git config --global user.name "github-actions[bot]"
|
run: mkdocs build --strict
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
- name: Build and Deploy
|
- name: Upload artifact
|
||||||
run: |
|
uses: actions/upload-pages-artifact@v3
|
||||||
mkdocs build --strict
|
with:
|
||||||
mkdocs gh-deploy --force --clean
|
path: ./site
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
Reference in New Issue
Block a user