Skip to content

Commit

Permalink
feat: added latest docs workflow (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankanno authored Jun 3, 2024
1 parent d1cca9d commit 4a899d1
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_cookiecutter_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
'/.github/workflows/ci.yml',
'/.github/workflows/codeql-analysis.yml',
'/.github/workflows/commitlint.yml',
'/.github/workflows/docs.yml',
'/.github/workflows/hadolint.yml',
'/.github/workflows/pr-labeler.yml',
'/.github/workflows/pr-size-labeler.yml',
Expand Down
64 changes: 64 additions & 0 deletions {{cookiecutter.package_name}}/.github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: docs

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# manual
workflow_dispatch:

env:
PRE_COMMIT_CACHE: ~/.cache/pre-commit

jobs:
tox-docs:
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
os: [ubuntu-latest]
env:
- TOXENV: "docs"
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
steps:
- uses: actions/checkout@v4
- name: Configure Python {% raw %}${{ matrix.python-version }}{% endraw %}
uses: actions/setup-python@v5
with:
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.5.1 tox==4.11.3 tox-gh
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: {% raw %}${{ env.PRE_COMMIT_CACHE }}{% endraw %}
key: {% raw %}${{ matrix.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}{% endraw %}
- name: Run tox
run: |
tox
shell: bash
env: {% raw %}${{ matrix.env }}{% endraw %}
- name: Prepare docs artifact
if: always()
shell: bash
run: |
mkdir artifact
cp -a .tox/docs_out/ artifact/html_docs
- name: Upload docs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: html_docs
path: ./artifact
- name: Deploy to gh pages
if: {% raw %}${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }}{% endraw %}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
publish_dir: .tox/docs_out/
destination_dir: ./latest

0 comments on commit 4a899d1

Please sign in to comment.