diff --git a/.github/workflows/refresh_dev_docs.yml b/.github/workflows/refresh_dev_docs.yml deleted file mode 100644 index b9ddea8..0000000 --- a/.github/workflows/refresh_dev_docs.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Refresh Dev Documentation - -on: - repository_dispatch: - types: ["refresh_dev"] - -jobs: - build: - runs-on: ubuntu-latest - 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 - - - name: Checkout libdebug - uses: actions/checkout@v4 - with: - repository: 'libdebug/libdebug' - path: 'libdebug' - ref: 'dev' - - - name: Install libdebug - run: | - cd libdebug - python -m pip install --upgrade . - - - name: Build documentation - 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 .. - rm -rf "docs/dev" - mv libdebug/docs/build/html docs/dev - echo $LIBDEBUG_VERSION > docs/dev/version - cd docs - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add dev/ - git commit -a -m "Autorefresh Dev Documentation" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - directory: 'docs' - force: true - tags: true diff --git a/.github/workflows/update_docs.yml b/.github/workflows/update_docs.yml index fee84c9..0e6c6a4 100644 --- a/.github/workflows/update_docs.yml +++ b/.github/workflows/update_docs.yml @@ -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 "chore: sync content from libdebug@gh-pages" + git push origin HEAD + fi