Skip to content

New CI for refreshing rolling docs #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions .github/workflows/refresh_dev_docs.yml

This file was deleted.

97 changes: 33 additions & 64 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,47 @@
name: Update Documentation

name: Sync libdebug gh-pages into main
on:
push:
branches: [main]
repository_dispatch:
types: ["update_docs"]
types: [refresh_rolling]

jobs:
build:
sync:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
permissions: { contents: write }

steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install documentation dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade Sphinx
python -m pip install --upgrade pydata-sphinx-theme
python -m pip install --upgrade sphinx_code_tabs

- name: Install libdebug dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libdwarf-dev libelf-dev libiberty-dev linux-headers-generic libc6-dbg
- uses: actions/checkout@v4
with: { fetch-depth: 0 }

- name: Checkout libdebug
- name: Checkout libdebug gh-pages
uses: actions/checkout@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repository: 'libdebug/libdebug'
path: 'libdebug'
ref: ${{ github.event.client_payload.sha }}
repository: libdebug/libdebug
ref: gh-pages
path: libdebug-pages
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install libdebug
- name: Sync files
run: |
cd libdebug
python -m pip install --upgrade .
rsync -av libdebug-pages/ ./ \
--exclude '.git' --exclude '.github/**'
rm -rf libdebug-pages

- name: Build documentation
- name: Commit & push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd libdebug/docs
./regenerate_docs.sh
rm -r build/html/_static/__pycache__

- name: Checkout docs
uses: actions/checkout@v4
with:
path: 'docs'

- name: Update files and commit changes
run: |
cd libdebug
export LIBDEBUG_VERSION=$(python -m setup --version 2>/dev/null)
cd ..
export OLD_VERSION=$(cat docs/latest/version)
echo "Removing docs/archive/$OLD_VERSION"
rm -rf "docs/archive/$OLD_VERSION"
mv docs/latest "docs/archive/$OLD_VERSION"
mv libdebug/docs/build/html docs/latest
echo $LIBDEBUG_VERSION > docs/latest/version
cd docs
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag -f $LIBDEBUG_VERSION
git add archive/$OLD_VERSION
git commit -a -m "Autorefresh Documentation"

- name: Push changes
uses: ad-m/github-push-action@master
with:
directory: 'docs'
force: true
tags: true
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet; then
echo "✅ Nothing to commit."
else
git add --all
git commit -m "docs: sync content from libdebug@gh-pages"
git push origin HEAD
fi