Skip to content

Commit 45f3676

Browse files
committed
Auto update adt version output inside README
1 parent 58c5c06 commit 45f3676

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ The curated list of tools installed as part of the Ansible automation developer
3232

3333
In addition to installing each of the above tools, `ansible-dev-tools` provides an easy way to show the versions of the content creation tools that make up the current development environment.
3434

35+
<!-- START -->
36+
3537
```
3638
$ adt --version
3739
ansible-builder 3.0.0
3840
ansible-core 2.16.2
3941
ansible-creator 24.1.0
4042
ansible-dev-environment 24.1.0
41-
ansible-dev-tools 0.2.0a1.dev26
43+
ansible-dev-tools 0.2.0a0
4244
ansible-lint 6.22.2
4345
ansible-navigator 3.6.0
4446
ansible-sign 0.1.1
@@ -47,6 +49,8 @@ pytest-ansible 24.1.2
4749
tox-ansible 2.1.0
4850
```
4951

52+
<!-- END -->
53+
5054
## Documentation
5155

5256
For more information, please visit our [documentation](https://ansible.readthedocs.io/projects/dev-tools/) page.

src/ansible_dev_tools/version_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
PKGS = [
77
"ansible-builder",
8-
"ansible-dev-environment",
9-
"ansible-dev-tools",
108
"ansible-core",
119
"ansible-creator",
10+
"ansible-dev-environment",
11+
"ansible-dev-tools",
1212
"ansible-lint",
1313
"ansible-navigator",
1414
"ansible-sign",

tools/update-readme.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!python3
2+
"""Script that tests rule markdown documentation."""
3+
from __future__ import annotations
4+
5+
import re
6+
import subprocess
7+
8+
from pathlib import Path
9+
10+
11+
if __name__ == "__main__":
12+
result = subprocess.run(
13+
"adt --version", # noqa: S607
14+
shell=True, # noqa: S602
15+
check=True,
16+
capture_output=True,
17+
text=True,
18+
)
19+
20+
file = Path("README.md")
21+
with file.open(encoding="utf-8", mode="r+") as fh:
22+
content = fh.read()
23+
content = re.sub(
24+
"<!-- START -->(.*?)<!-- END -->",
25+
f"<!-- START -->\n\n```\n$ adt --version\n{result.stdout}```\n\n<!-- END -->",
26+
content,
27+
flags=re.DOTALL,
28+
)
29+
fh.seek(0)
30+
fh.write(content)
31+
fh.truncate()

tox.ini

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ set_env =
3434
commands =
3535
coverage run --debug=trace -m pytest {posargs}
3636
sh -c "coverage combine -q .tox/.coverage.* && coverage xml || true && coverage report"
37+
git diff --exit-code
3738
allowlist_externals =
39+
bash
3840
git
3941
rm
4042
sh
@@ -65,18 +67,21 @@ commands =
6567
--outdir {toxinidir}/dist/ \
6668
{toxinidir}
6769
sh -c "python -m twine check --strict {toxinidir}/dist/*"
68-
pip install --target=.tox/dist '.[test,docs]'
70+
pip install '.[test,docs]'
71+
adt --version
6972

7073
[testenv:docs]
7174
description = Builds docs
72-
package = editable
73-
skip_install = false
75+
skip_install = true
7476
extras =
7577
docs
7678
set_env =
7779
NO_COLOR = 1
7880
TERM = dump
7981
commands =
82+
bash -c "SETUPTOOLS_SCM_PRETEND_VERSION=$(git describe --tags --abbrev=0) pip install -q -e ."
83+
adt --version
84+
python3 tools/update-readme.py
8085
mkdocs {posargs:build --strict --site-dir=_readthedocs/html/}
8186

8287
[testenv:deps]

0 commit comments

Comments
 (0)