mhapach / projectversions
项目版本控制
0.0.18
2022-12-05 13:50 UTC
README
此包是Laravel (7.0+)实用工具,帮助您保留和管理项目版本(增加主版本、次要版本号)
同时,还有一个用于从VCS(目前仅支持基于git)检查版本的UI
安装
在安装之前,您需要确保您的服务器上已安装git
步骤1. 使用Composer将Eloquent Model Generator添加到您的项目中
$ composer require mhapach/projectversions
在.env中设置以下值
- optional fields
``` bash
#if you will not set it you will be propted to enter you account in Authorisation form for VCS in UI
VCS_LOGIN=Yourlogin
VCS_PASSWORD=YourPassword
#if it true you then access to UI will be through auth middleware, so only authorised users will able to update project
VCS_USE_AUTH_MIDDLEWARE=true
#if VCS_USE_AUTH_MIDDLEWARE is true then in this field enter comma separated ids of users allowed to checkout and update project from VCS
VCS_UPDATE_USERS=1,3
步骤2. 在config/app.php中注册ProjectVersionsServiceProvider
'providers' => [
//...
\mhapach\ProjectVersions\ProjectVersionsServiceProvider::class,
]
用法
在您的代码中使用项目版本。当您需要防止加载缓存中的js和css库时,这非常有用
Example 1 - getting current version number
print app('project.version');
Example 2 - usage within blade code
<link href="{{ asset('css/app.css') }}?v={{app("project.version")}}" rel="stylesheet">
使用Artisan命令轻松增加版本号
php artisan pv:commit
Which should commit last changes into VCS and print the new version number in file
project.info in root folder of project
在两个提交之间创建差异zip存档或使用最后几个提交的数量
php artisan pv:archive --help
Shows you arguments and options of command pv:archive
Example 1 - make zip archive between to commits
php artisan pv:archive commit_hash1 commit_hash2
Example 2 - make zip archive for last 10 commits
php artisan pv:archive -s 10
Example 3 - make zip archive for last 10 commits and specify path of archive file
php artisan pv:archive -s 10 -p storage/app/git_archives
or
php artisan pv:archive --shift=10 --path=storage/app/git_archives
project.info文件示例
---
{
"Project": "Your megaproject",
"Description": "New build commit",
"Date": "2022-09-02 11:42:09",
"Version": "1.1.2.12345"
}
Artisan命令使用示例(注意:请从项目的根目录运行所有示例)
Example 1 (source version 1.1.2.12345-Beta)
Command: php artisan pv:commit versionNumber (the same as: php artisan pv:commit versionNumber=+1)
Result: changes will be commited with descrition "New build commit. Version: 2.0.0.12346-Pre-Alfa"
In svn trunk will be coppied to folder tags with name of new version 2.0.0.1-Pre-Alfa
Example 2 (source version 1.1.2.12345-Beta)
Command: php artisan pv:commit versionNumber=3
Result: changes will be commited with descrition "New build commit. 3.1.2.12346-Beta"
In svn trunk will be coppied to folder tags with name of new version 3.1.2.12346-Beta
Example 3 (source version 1.1.2.12345-Beta)
Command: php artisan pv:commit releaseNumber (the same as: php artisan pv:commit releaseNumber=+1)
Result: changes will be commited with descrition "New build commit. Version: 1.2.0.1-Pre-Alfa"
In svn trunk will be coppied to folder tags with name of new version 1.2.0.1-Pre-Alfa
Example 4 (source version 1.1.2.12345-Beta)
Command: php artisan pv:commit buildNumber (the same as: php artisan pv:commit buildNumber=+1)
Result: changes will be commited with descrition "New build commit. Version: 1.1.3.1-Beta
Example 5 (source version 1.1.2.12345-Beta)
Command: php artisan pv:commit releaseType (the same as: php artisan pv:commit releaseType=+1)
Result: changes will be commited with descrition "New build commit. Version: 1.1.2.12346-Release-Candidate
Example 6 (source version 1.1.2.12345-Beta)
Command: php artisan pv:commit releaseType="Release"
Result: changes will be commited with descrition "New build commit. Version: 1.1.2.12346-Release
回滚到先前的项目版本或检出最新提交的版本。
这对于在开发服务器上进行项目测试并希望进行回归测试非常有用。
UI interface address
http://yourproject/project_versions
通过AJAX请求检查是否存在最新版本 - 获取JSON响应并在您的JavaScript中使用它
http://yourproject/project_versions/new
检出最新的VCS版本 - 获取JSON响应并在您的JavaScript中使用,此命令将更新您的项目到最新版本
http://yourproject/project_versions/update
获取项目的当前版本
http://yourproject/project_versions/version
变更日志
请参阅变更日志以获取有关最近更改的更多信息。
贡献
请参阅contributing.md以获取详细信息和工作清单。
安全性
如果您发现任何安全相关的问题,请通过电子邮件向作者发送电子邮件,而不是使用问题跟踪器。
致谢
许可证
许可证。有关更多信息,请参阅许可证文件。