diff --git a/README-generator/make_readme.py b/README-generator/make_readme.py index ddcc3d2..d00e1ed 100755 --- a/README-generator/make_readme.py +++ b/README-generator/make_readme.py @@ -53,6 +53,9 @@ def generate_READMEs(app_path: str): else: disclaimer = None + # Get the current branch using git inside the app path + branch = os.popen("git --git-dir=%s/.git --work-tree=%s rev-parse --abbrev-ref HEAD" % (app_path, app_path)).read().strip() + out = template.render( lang=lang, upstream=upstream, @@ -60,6 +63,7 @@ def generate_READMEs(app_path: str): screenshots=screenshots, disclaimer=disclaimer, manifest=manifest, + branch=branch, ) (app_path / f"README{lang_suffix}.md").write_text(out) diff --git a/README-generator/templates/README.md.j2 b/README-generator/templates/README.md.j2 index 6e58002..b0eb5c2 100644 --- a/README-generator/templates/README.md.j2 +++ b/README-generator/templates/README.md.j2 @@ -31,7 +31,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in {% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %} -**Shipped version:** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %} +**Shipped version:** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %}{% if branch != "master" %} *(This is the `{{ branch }}` branch. See the [`master` branch](https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/master) for the version in the catalog.)*{% endif %} {% if upstream.demo %}**Demo:** {{upstream.demo}}{% endif %} diff --git a/README-generator/templates/README_fr.md.j2 b/README-generator/templates/README_fr.md.j2 index 9169cbb..63ca8c4 100644 --- a/README-generator/templates/README_fr.md.j2 +++ b/README-generator/templates/README_fr.md.j2 @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour {% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %} -**Version incluse :** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %} +**Version incluse :** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %}{% if branch != "master" %} *(Vous êtes sur la branche `{{ branch }}`. Voir la [branche `master`](https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/master) pour la version du catalogue.)*{% endif %} {% if upstream.demo %}**Démo :** {{upstream.demo}}{% endif %}