diff --git a/.github/workflows/docs_updater.yml b/.github/workflows/docs_updater.yml index 58afcbf3de..365d92a98c 100644 --- a/.github/workflows/docs_updater.yml +++ b/.github/workflows/docs_updater.yml @@ -24,16 +24,6 @@ jobs: - name: Generate docs run: | poetry run bbot/scripts/docs.py - - name: Commit and Push Changes - run: | - git config user.name "BBOT Docs Autopublish" - git config user.email "info@blacklanternsecurity.com" - git checkout -b update-docs - git add "*.md" "docs/data/chord_graph/*.json" - git commit -m "Refresh module docs" - git push -u origin update-docs --force - env: - GITHUB_TOKEN: ${{ secrets.BBOT_DOCS_UPDATER_PAT }} - name: Create or Update Pull Request uses: peter-evans/create-pull-request@v7 with: @@ -42,4 +32,3 @@ jobs: base: dev title: "Daily Docs Update" body: "This is an automated pull request to update the documentation." - update-existing: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 78b0cbd93e..507b7ac547 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -114,6 +114,49 @@ jobs: repository: blacklanternsecurity/bbot outputs: BBOT_VERSION: ${{ steps.version.outputs.BBOT_VERSION }} + publish_docs: + runs-on: ubuntu-latest + if: github.event_name == 'push' && (github.ref == 'refs/heads/stable' || github.ref == 'refs/heads/dev') + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.BBOT_DOCS_UPDATER_PAT }} + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - name: Install dependencies + run: | + pip install poetry + poetry install --only=docs + - name: Configure Git + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git fetch origin gh-pages:refs/remotes/origin/gh-pages + if git show-ref --verify --quiet refs/heads/gh-pages; then + git branch -f gh-pages origin/gh-pages + else + git branch --track gh-pages origin/gh-pages + fi + - name: Generate docs (stable branch) + if: github.ref == 'refs/heads/stable' + run: | + poetry run mike deploy Stable + - name: Generate docs (dev branch) + if: github.ref == 'refs/heads/dev' + run: | + poetry run mike deploy Dev + - name: Publish docs + run: | + git switch gh-pages + git push # tag_commit: # needs: publish_code # runs-on: ubuntu-latest