mirror of
https://github.com/m417z/ntdoc
synced 2026-06-08 15:38:00 +00:00
76 lines
2.6 KiB
YAML
76 lines
2.6 KiB
YAML
name: Generate static site
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
schedule:
|
|
- cron: '0 7 * * *'
|
|
|
|
concurrency:
|
|
group: generate-static-site
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
run:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
path: main
|
|
- name: Checkout winsiderss/systeminformer
|
|
uses: actions/checkout@v6
|
|
with:
|
|
repository: winsiderss/systeminformer
|
|
path: systeminformer
|
|
fetch-depth: 0
|
|
sparse-checkout: |
|
|
phnt/include
|
|
# For ntfill.h
|
|
KSystemInformer/include
|
|
- name: Checkout m417z/windows-docs-scraper
|
|
uses: actions/checkout@v6
|
|
with:
|
|
repository: m417z/windows-docs-scraper
|
|
ref: gh-pages
|
|
path: windows-docs
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Install Python dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r main/requirements.txt
|
|
- name: Generate docs
|
|
run: |
|
|
commit=$(git -C systeminformer rev-list HEAD -- phnt/include | head -n 1)
|
|
ntfill_commit=$(git -C systeminformer rev-list HEAD -- KSystemInformer/include/ntfill.h | head -n 1)
|
|
cd main
|
|
python -u generate_docs.py \
|
|
--path ../systeminformer/phnt/include \
|
|
--commit $commit \
|
|
--ntfill-path ../systeminformer/KSystemInformer/include/ntfill.h \
|
|
--ntfill-commit $ntfill_commit \
|
|
--windows-docs-path ../windows-docs
|
|
- name: Deploy
|
|
run: |
|
|
src_dir=main/docs
|
|
deploy_dir="${{ runner.temp }}/deploy"
|
|
deploy_branch=gh-pages
|
|
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
echo Cloning the repository
|
|
git clone --branch $deploy_branch --depth 1 --filter=blob:none --no-checkout https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git "$deploy_dir"
|
|
echo Adding generated files to the repository
|
|
git --git-dir="$deploy_dir/.git" --work-tree="$src_dir" add -A
|
|
touch "$deploy_dir/.nojekyll"
|
|
git -C "$deploy_dir" add .nojekyll
|
|
echo Committing changes
|
|
git -C "$deploy_dir" diff-index --cached --quiet HEAD || git -C "$deploy_dir" commit -m "deploy: ${{ github.sha }}"
|
|
echo Pushing to GitHub
|
|
git -C "$deploy_dir" push origin $deploy_branch
|