biurad/monorepo

用于处理 Git 仓库和 PHP 作为单仓库的库

dev-master / 2.x-dev 2024-02-21 08:07 UTC

This package is auto-updated.

Last update: 2024-09-21 09:22:08 UTC


README

Poakium 单仓库

Latest Version Software License Code Maintainability Coverage Status Quality Score

一个用于处理单仓库项目的 PHP 库。这个库处理子目录提交的拆分和将标签推送到多个远程仓库,它依赖于单仓库工作目录中的 .monorepo 配置文件。

📦 安装

需要 PHP 8.0 或更高版本和 GIT 2.30 或更高版本。推荐的安装方式是使用 Composer。只需运行

$ composer require biurad/monorepo

📍 快速入门

这个库的主要目的是持续将单仓库项目分割成多个只读仓库。处理分支和标签的分割,这个库可以真正地扩展,您可以定义特定工作运行的不同的工作类。内部使用 splitsh/lite 以实现高性能。

注意:强烈建议安装 git filter-repo,因为这允许您多次合并多个仓库,而默认方式只合并一次,重新合并可能会非常危险。

为了使用这个库,项目工作目录中必须存在一个 .monorepo yaml 语法配置文件。以下是一个 .monorepo 配置示例

# URL or absolute path to the remote GIT repository of the monorepo
base_url: https://github.com/YOUR-VENDORNAME/YOUR-PROJECT.git

# All branches that match this regular expression will be split by default
branch_filter: /^(main|develop|\d+\.\d+)$/

# A list of workers which should run when the monorepo command is called
workers:
  main:
    - Biurad\Monorepo\Worker\SplitCommitsWorker
  #  - Custom\MonorepoWorker
  merge:
    - Biurad\Monorepo\Worker\MergeRepoWorker
  #release:
  #  - Biurad\Monorepo\Worker\PushNextDevWorker


# List of all split projects
repositories:
  # The first split project living in the folder /first-subfolder
  first-subfolder:
    # URL or absolute path to the remote GIT repository
    url: https://github.com/YOUR-VENDORNAME/YOUR-FIRST-SPLIT-PROJECT.git
  # Second split project living in the folder /second-subfolder
  second-subfolder:
    # URL or absolute path to the remote GIT repository
    url: https://github.com/YOUR-VENDORNAME/YOUR-SECOND-SPLIT-PROJECT.git
    # A path which exist in the root path where monorepo command is called
    # If not defined, this config key (second-subfolder) is used as path
    path: php-example
    # If true, Repo supports merging & splitting. If false, only splitting is supported
    merge: true

# An array of configuration's which custom workers may rely on
extra: ~

这个库使用一个单工作流程命令,它接受一个参数,即指定的作业名称(默认为 main)以及类工作所需的许多选项。您也可以将这个库用于您的 CI 工作流程,如果您希望在运行此库的 GitHub Actions CI 中对创建的所有提交和标签进行签名。然后检查 crazy-max/ghaction-import-gpg 仓库以启用此功能。

要使用此库,只需在终端运行以下命令

$ php vendor/bin/monorepo

📓 文档

有关如何使用此库的深入文档可以在 docs.biurad.com 找到。还建议浏览 tests 目录中的单元测试。

🙌 赞助者

如果这个库被应用到您的项目中,或者您有兴趣支持我们,请考虑 捐赠 以支持未来的开发。

👥 信用 & 致谢

📄 许可证

Poakium 单仓库是完全免费的,并使用 BSD 3 许可证 发布。