Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/docker-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: docs-image

on:
push:
branches: [ master ]
paths:
- 'docs/Dockerfile'
pull_request:
branches: [ master ]
paths:
- 'docs/Dockerfile'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE: ghcr.io/${{ github.repository }}
steps:
- uses: actions/checkout@v4

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: docs/Dockerfile
push: true
tags: |
${{ env.IMAGE }}:docs-build
54 changes: 36 additions & 18 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,20 +25,44 @@ jobs:
env:
FORCE_COLOR: 1

- name: Install LaTeX dependencies
run: |
sudo apt-get update
sudo apt-get install -y texlive-full latexmk
build-pdf:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}:docs-build
steps:
- uses: actions/checkout@v4

- name: Install Python dependencies
run: uv sync --group docs

- name: Build PDF documentation
run: uv run make -C docs latexpdf
env:
FORCE_COLOR: 1

- name: Copy PDF to static directory
run: |
mkdir -p docs/_static
cp docs/_build/latex/argclass.pdf docs/_static/
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: documentation-pdf
path: docs/_build/latex/argclass.pdf

build-html:
needs: build-pdf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"

- name: Install Python dependencies
run: uv sync --group docs

- name: Download PDF artifact
uses: actions/download-artifact@v4
with:
name: documentation-pdf
path: docs/_static

- name: Build HTML documentation
run: uv run make -C docs html
Expand All @@ -51,14 +75,8 @@ jobs:
name: documentation
path: docs/_build/html

- name: Upload PDF documentation
uses: actions/upload-artifact@v4
with:
name: documentation-pdf
path: docs/_build/latex/argclass.pdf

publish:
needs: build
needs: build-html
runs-on: ubuntu-latest
container: rclone/rclone:latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand Down
3 changes: 3 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.13-slim

LABEL org.opencontainers.image.source="https://github.com/mosquito/argclass"
LABEL org.opencontainers.image.description="LaTeX build environment for argclass docs"

# Install LaTeX (full distribution) and required packages
RUN apt-get update && apt-get install -y --no-install-recommends \
texlive-full \
Expand Down
8 changes: 5 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SPHINXOPTS ?= -W
SPHINXBUILD ?= uv run --group docs sphinx-build
SOURCEDIR = .
BUILDDIR = _build
DOCKER_IMAGE = argclass-docs
DOCKER_IMAGE ?= ghcr.io/mosquito/argclass:docs-build

.PHONY: help clean html latexpdf pdf docker-pdf test all

Expand Down Expand Up @@ -33,9 +33,11 @@ latexpdf:
pdf: latexpdf

# Build PDF using Docker (no local LaTeX installation needed)
# Override DOCKER_IMAGE to use a local build:
# make docker-pdf DOCKER_IMAGE=argclass-docs-local
docker-pdf:
@echo "Building Docker image..."
docker build -t $(DOCKER_IMAGE) -f Dockerfile ..
@echo "Pulling Docker image $(DOCKER_IMAGE)..."
-docker pull $(DOCKER_IMAGE)
@echo "Installing dependencies and building LaTeX sources..."
docker run --rm -v $(CURDIR)/..:/project -w /project $(DOCKER_IMAGE) \
sh -c "uv sync --group docs && uv run --group docs sphinx-build -W -b latex docs docs/_build/latex"
Expand Down
Loading