webregulate/deploy-helper

一个易于使用的命令行界面,用于部署更改、提交、文件等,并能够运行npm命令,以及将构建部署到实时服务器

v1.1.12 2024-06-24 09:23 UTC

This package is auto-updated.

Last update: 2024-09-24 10:04:08 UTC


README

-- 安装 --

1. 使用Composer要求

composer require webregulate/deploy-helper --dev

2. 重要:将以下内容添加到您的.gitignore文件中

deployhelper.json

3. 运行安装脚本

php ./vendor/webregulate/deploy-helper/install.php

这将创建默认的deployhelper.json配置文件,并将deployhelper PHP 脚本放在项目的根目录。

4. 设置deployhelper.json

注意,您可以使用{env:keyName}将环境变量的当前值注入到命令中。这对于设置构建目录、应用程序目录和其他特定于环境的值很有用。

{
    "config": {
        "commands": {
            "deploy": [
                "local rmdir /s /q \"{env:buildDirectory}\"",
                "local cd {env:applicationDirectory} && npm run build",
                "git",
                "build"
            ]
        }
    },
    "environments": {
        "devserver": {
            "remoteBasePath": "/home/unixuser/",
            "localPrivateKeyPath": "/local/path/to/private/key",
            "host": "example.com",
            "user": "unixuser",
            "pass": "unixpassword",
            "port": 22,
            "applicationDirectory": "laravel_application",
            "buildDirectory": "public_html/build",
            "activeGitChangesIgnoreFiles": ["*deployhelper*", "*.htaccess", "*.env", "*rundev.bat"]
        },
        "production": {
            "remoteBasePath": "/home/unixuser2/",
            "localPrivateKeyPath": "/local/path/to/private/key",
            "host": "example2.com",
            "user": "unixuser2",
            "pass": "unixpassword2",
            "port": 22,
            "applicationDirectory": "laravel_application",
            "buildDirectory": "public_html/build",
            "activeGitChangesIgnoreFiles": ["*deployhelper*", "*.htaccess", "*.env", "*rundev.bat"]
        }
    }
}

注意,您可以根据您的设置添加或删除任何组(如上面的devserver和production组)。只需一个即可。

-- 运行DeployHelper --

用php运行

php ./deployhelper

更多帮助即将推出...