leowebguy/git-info

通过twig输出git信息

安装: 4

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:craft-plugin

2.0.0 2024-03-27 02:02 UTC

This package is auto-updated.

Last update: 2024-09-27 04:47:29 UTC


README

通过twig输出git信息

安装

Shell

composer require leowebguy/git-info -w && php craft plugin/install git-info

DDEV

ddev composer require leowebguy/git-info -w && ddev exec php craft plugin/install git-info

用法

{{ craft.git.branch }} >> 当前分支,例如:stage

{{ craft.git.remoteUrl }} >> 例如:github.com:leowebguy/git-info.git

{{ craft.git.lastTag }} >> 例如:3.1.2

{{ craft.git.commitHash }} >> 最后提交的hash值

{{ craft.git.commitAuthor }} >> 最后提交者(姓名)

{{ craft.git.commitDate }} >> 最后提交日期

{% if not craft.app.config.custom.isProd %}
    <div style="position: fixed; bottom: 1rem; right: 1rem; padding: 6px 10px; text-align: right; border: solid 1px #eee; z-index: 999;">
        {{ 'branch: ' ~ craft.git.branch }}<br>
        {{ 'remote url: ' ~ craft.git.remoteUrl }}<br>
        {{ 'last tag: ' ~ craft.git.lastTag }}<br>
        {{ 'commit hash: ' ~ craft.git.commitHash }}<br>
        {{ 'commit author: ' ~ craft.git.commitAuthor }}<br>
        {{ 'commit date: ' ~ craft.git.commitDate }}
    </div>
{% endif %}

Screenshot