Skip to content

Commit f566310

Browse files
authored
Only put container docs in if publishing them (#114)
2 parents 19a45ae + f28fde1 commit f566310

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

template/README.md.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ how it does it, and why people should use it.
1313
Source | <{{repo_url}}>
1414
:---: | :---:
1515
PyPI | `pip install {{distribution_name}}`
16-
{% if sphinx %}Documentation | <{{docs_url}}>{% endif %}
16+
{% if docker %}Docker | `docker run ghcr.io/{{github_org | lower}}/{{repo_name}}:latest`
17+
{% endif %}{% if sphinx %}Documentation | <{{docs_url}}>{% endif %}
1718
Releases | <{{repo_url}}/releases>
1819

1920
This is where you should put some images or code snippets that illustrate

template/{% if sphinx %}docs{% endif %}/how-to/run-container.md.jinja renamed to template/{% if sphinx %}docs{% endif %}/how-to/{% if docker %}run-container.md{% endif %}.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ installed are available on [Github Container Registry](https://ghcr.io/{{github_
88
To pull the container from github container registry and run:
99

1010
```
11-
$ docker run ghcr.io/{{github_org}}/{{repo_name}}:main --version
11+
$ docker run ghcr.io/{{github_org | lower}}/{{repo_name}}:latest --version
1212
```
1313

14-
To get a released version, use a numbered release instead of `main`.
14+
To get a released version, use a numbered release instead of `latest`.

tests/test_example.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def make_venv(project_path: Path) -> callable:
4747
def test_template(tmp_path: Path):
4848
copy_project(tmp_path)
4949
run = make_venv(tmp_path)
50+
container_doc = tmp_path / "docs" / "how-to" / "run-container.md"
51+
assert container_doc.exists()
5052
run("./venv/bin/tox -p")
5153
run("./venv/bin/pip install build twine")
5254
run("./venv/bin/python -m build")
@@ -59,6 +61,12 @@ def test_template_no_docs(tmp_path: Path):
5961
run("./venv/bin/tox -p")
6062

6163

64+
def test_template_no_docker_has_no_docs(tmp_path: Path):
65+
copy_project(tmp_path, docker=False)
66+
container_doc = tmp_path / "docs" / "how-to" / "run-container.md"
67+
assert not container_doc.exists()
68+
69+
6270
def test_bad_repo_name(tmp_path: Path):
6371
with pytest.raises(ValidationError, match="bad:thing is not a valid repo name"):
6472
copy_project(tmp_path, repo_name="bad:thing")

0 commit comments

Comments
 (0)