|
| 1 | +name: Build and Deploy Strelka Docs |
| 2 | + |
| 3 | +# Trigger the workflow on each day to update docs |
| 4 | +on: |
| 5 | + # Runs on pushes targeting the default branches |
| 6 | + push: |
| 7 | + branches: ["gh-pages", "main"] |
| 8 | + # Also run on a daily schedule |
| 9 | + schedule: |
| 10 | + - cron: '0 2 * * *' # Also run @ 2 AM UTC daily |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-deploy-pages: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + # Checkout the repository |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + ref: main # Ensure you checkout the main branch first |
| 22 | + |
| 23 | + # Fetch the gh-pages branch |
| 24 | + - name: Fetch gh-pages branch |
| 25 | + run: git fetch origin gh-pages |
| 26 | + |
| 27 | + # Create the docs/Scanners directory if it doesn't exist |
| 28 | + - name: Create docs/Scanners directory |
| 29 | + run: mkdir -p docs/Scanners |
| 30 | + |
| 31 | + # Set up Python 3.12 |
| 32 | + - name: Set up Python 3.12 |
| 33 | + uses: actions/setup-python@v2 |
| 34 | + with: |
| 35 | + python-version: 3.12 |
| 36 | + |
| 37 | + # Upgrade pip |
| 38 | + - name: Upgrade pip |
| 39 | + run: python -m pip install --upgrade pip |
| 40 | + |
| 41 | + # Install Poetry |
| 42 | + - name: Install Poetry |
| 43 | + run: pip install poetry |
| 44 | + |
| 45 | + # Install dependencies using Poetry |
| 46 | + - name: Install dependencies |
| 47 | + run: poetry install |
| 48 | + |
| 49 | + # Clone the strelka repository |
| 50 | + - name: Clone strelka repository |
| 51 | + run: git clone https://github.com/target/strelka.git |
| 52 | + |
| 53 | + # Build the docs using the provided script |
| 54 | + - name: Build docs |
| 55 | + run: poetry run python build_docs.py |
| 56 | + |
| 57 | + # Build the site using mkdocs |
| 58 | + - name: Build site with mkdocs |
| 59 | + run: poetry run mkdocs build |
| 60 | + |
| 61 | + # Deploy the site to GitHub Pages |
| 62 | + - name: Deploy to GitHub Pages |
| 63 | + run: poetry run mkdocs gh-deploy |
0 commit comments