Skip to content

Commit 7af7d6e

Browse files
authored
Merge pull request #1 from libdebug/new-ci
New CI for refreshing rolling docs
2 parents 7af9f59 + e4aa018 commit 7af7d6e

File tree

2 files changed

+33
-138
lines changed

2 files changed

+33
-138
lines changed

.github/workflows/refresh_dev_docs.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/update_docs.yml

Lines changed: 33 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,47 @@
1-
name: Update Documentation
2-
1+
name: Sync libdebug gh-pages into main
32
on:
3+
push:
4+
branches: [main]
45
repository_dispatch:
5-
types: ["update_docs"]
6+
types: [refresh_rolling]
67

78
jobs:
8-
build:
9+
sync:
10+
if: github.actor != 'github-actions[bot]'
911
runs-on: ubuntu-latest
10-
permissions:
11-
contents: write
12+
permissions: { contents: write }
1213

1314
steps:
14-
- name: Set up Python
15-
uses: actions/setup-python@v5
16-
with:
17-
python-version: 3.12
18-
19-
- name: Install documentation dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
python -m pip install --upgrade setuptools
23-
python -m pip install --upgrade Sphinx
24-
python -m pip install --upgrade pydata-sphinx-theme
25-
python -m pip install --upgrade sphinx_code_tabs
26-
27-
- name: Install libdebug dependencies
28-
run: |
29-
sudo apt-get update
30-
sudo apt-get install -y --no-install-recommends libdwarf-dev libelf-dev libiberty-dev linux-headers-generic libc6-dbg
15+
- uses: actions/checkout@v4
16+
with: { fetch-depth: 0 }
3117

32-
- name: Checkout libdebug
18+
- name: Checkout libdebug gh-pages
3319
uses: actions/checkout@v4
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3422
with:
35-
repository: 'libdebug/libdebug'
36-
path: 'libdebug'
37-
ref: ${{ github.event.client_payload.sha }}
23+
repository: libdebug/libdebug
24+
ref: gh-pages
25+
path: libdebug-pages
26+
fetch-depth: 1
27+
token: ${{ secrets.GITHUB_TOKEN }}
3828

39-
- name: Install libdebug
29+
- name: Sync files
4030
run: |
41-
cd libdebug
42-
python -m pip install --upgrade .
31+
rsync -av libdebug-pages/ ./ \
32+
--exclude '.git' --exclude '.github/**'
33+
rm -rf libdebug-pages
4334
44-
- name: Build documentation
35+
- name: Commit & push
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4538
run: |
46-
cd libdebug/docs
47-
./regenerate_docs.sh
48-
rm -r build/html/_static/__pycache__
49-
50-
- name: Checkout docs
51-
uses: actions/checkout@v4
52-
with:
53-
path: 'docs'
54-
55-
- name: Update files and commit changes
56-
run: |
57-
cd libdebug
58-
export LIBDEBUG_VERSION=$(python -m setup --version 2>/dev/null)
59-
cd ..
60-
export OLD_VERSION=$(cat docs/latest/version)
61-
echo "Removing docs/archive/$OLD_VERSION"
62-
rm -rf "docs/archive/$OLD_VERSION"
63-
mv docs/latest "docs/archive/$OLD_VERSION"
64-
mv libdebug/docs/build/html docs/latest
65-
echo $LIBDEBUG_VERSION > docs/latest/version
66-
cd docs
67-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
68-
git config --local user.name "github-actions[bot]"
69-
git tag -f $LIBDEBUG_VERSION
70-
git add archive/$OLD_VERSION
71-
git commit -a -m "Autorefresh Documentation"
72-
73-
- name: Push changes
74-
uses: ad-m/github-push-action@master
75-
with:
76-
directory: 'docs'
77-
force: true
78-
tags: true
39+
git config user.name "github-actions[bot]"
40+
git config user.email "github-actions[bot]@users.noreply.github.com"
41+
if git diff --quiet; then
42+
echo "✅ Nothing to commit."
43+
else
44+
git add --all
45+
git commit -m "docs: sync content from libdebug@gh-pages"
46+
git push origin HEAD
47+
fi

0 commit comments

Comments
 (0)