定制 bitcodesa/deployment-script 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bitcodesa/deployment-script

最新稳定版本:0.0.2

Composer 安装命令:

composer require bitcodesa/deployment-script

包简介

The package add artisan command that all user to do collected artisan or terminal command at once.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Package Description

This package provides a convenient way to run groups of Artisan commands through a pre-defined configuration file. This can be useful for automating tasks such as deployment, database maintenance, and testing.

Features

  • Run groups of Artisan commands with a single command
  • Override command options in the configuration file
  • Pass values to artisan commands like --force.
  • Run command like git pull.

Example

For example, to run the following commands:

php artisan migrate:fresh
php artisan cache:clear
php artisan route:cache
return [
    'commands' => [
        [
            "type" => "artisan",
            "command" => "migrate:fresh"
        ],
        [
            "type" => "artisan",
            "command" => "cache:clear"
        ],
        [
            "type" => "artisan",
            "command" => "route:cache"
        ],
    ],
];

Then, you would run the following command:

php artisan deploy

This package is a valuable tool for any Laravel developer who needs to automate tasks or run groups of Artisan commands on a regular basis.

Installation

You can install the package via composer:

composer require bitcodesa/deployment-script

You can publish the config file with:

php artisan vendor:publish --tag="deployment-script-config"

This is the contents of the published config file:

return [
     "commands" => [
        [
            "type" => "console",
            "command" => "git pull"
        ],
        [
            "type" => "console",
            "command" => "composer install --optimize-autoloader",
        ],
        [
            "type" => "artisan",
            "command" => "migrate",
            "values" => [
                "--force" => true
            ]
        ],
        [
            "type" => "artisan",
            "command" => "cache:clear",
        ],
    ]
];

Allow used in production

To allow used of deploy script in the production env you should allow it in the config config/deployment-script.php

[
// config/deployment-script.php
"allow_in_production" => true;
]

Note: By default the script is not allowed in production.

Production Commands:

you can specify commands to run only in the production env: put the array inside config file config/deployment-script.php then specify the key name of this array into var production for example:

[
// config/deployment-script.php
"production_commands" => [
    [
            "type" => "artisan",
            "command" => "migrate",
            "values" => [
                "--force" => true
            ]
        ],
        [
            "type" => "artisan",
            "command" => "cache:clear",
        ],
    ]
"production" => "production_commands";
];

Note: if not specified the default commands array well be used.

Usage

php artisan deploy

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 113
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-13