Skip to content

Commit

Permalink
Merge pull request #1905 from blacklanternsecurity/fix-docs-autopublish
Browse files Browse the repository at this point in the history
Improve auto docs publishing
  • Loading branch information
TheTechromancer authored Nov 1, 2024
2 parents a2310d4 + 2bfd327 commit 0d43e80
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/docs_updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
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:
Expand All @@ -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
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]
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
Expand Down

0 comments on commit 0d43e80

Please sign in to comment.