mirror of
https://github.com/SpecterOps/Nemesis
synced 2026-06-08 12:36:42 +00:00
72 lines
1.7 KiB
YAML
72 lines
1.7 KiB
YAML
name: Build documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
# Only trigger workflow when documentation files are changed
|
|
paths:
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
- '.github/workflows/docs.yml'
|
|
|
|
# Prevent this workflow from running concurrently with the helm-release.yml workflow
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
docs:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
|
|
environment:
|
|
name: github-pages
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python virtualenv
|
|
run: |
|
|
pip install --upgrade pip
|
|
python -m venv env
|
|
source env/bin/activate
|
|
pip install -r docs/requirements.txt
|
|
|
|
- name: Build documentation
|
|
run: |
|
|
source env/bin/activate
|
|
mkdocs build
|
|
|
|
- name: Add existing Helm repository index.yml file
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
PAGES_URL=$(gh api \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
/repos/${{ github.repository }}/pages \
|
|
| jq -r '.html_url')
|
|
|
|
if [[ "$PAGES_URL" != "null" ]]; then
|
|
HTTP_STATUS=$(curl -sL -w '%{http_code}' "${PAGES_URL%/}/index.yaml" -o site/index.yaml)
|
|
if [[ "$HTTP_STATUS" != "200" ]]; then
|
|
rm site/index.yaml
|
|
fi
|
|
fi
|
|
|
|
- name: Setup Github pages
|
|
uses: actions/configure-pages@v4
|
|
|
|
- name: Create Github pages artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: site
|
|
|
|
- name: Deploy documentation to Github pages
|
|
uses: actions/deploy-pages@v4
|