server-deploy-tools: 一个 go 实现的简单的部署工具

一个go实现的部署工具,无需user/pass 配置(假设: 你自己已经配置好了免密登录)
更新于: 2025-08-30 08:41:36
项目主页: https://github.com/aric-go/server-deploy-tools

安装

git clone git@github.com:aric-go/server-deploy-tools.git

# 编译
npm run build
# link 到 /usr/local/bin 目录
npm run bin:link

帮助

$ sdt -h
Ssh to server and deploy projects.

Usage:
  server-deploy-tools [flags]
  server-deploy-tools [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  deploy      Deploy project to remote server
  help        Help about any command
  init        Initialize configuration file

Flags:
  -h, --help      help for server-deploy-tools
  -v, --version   Display the version of the tool

Use "server-deploy-tools [command] --help" for more information about a command.

命令参数

功能使用
初始化配置
sdt init --force
部署
sdt deploy
部署 - 仅本地
sdt deploy --local
部署 - 仅远程
sdt deploy --remote

示例配置 .sdt.config.yml

ssh:
  host: aly1

variables:
  var1: abc

local:
  script:
    - echo "Current host is $(hostname), ${vars.var1}"
    - echo "hello world from local"
remote:
  script:
    - echo "hello world from remote"
    - echo "Current host is $(hostname)"

使用示例

$ sdt d

[🖥  LOCAL]------------------------------
Current host is aric-ap7
hello world from local

[🌎 REMOTE]------------------------------
2025/08/29 08:17:27 sdt ℹ️ hello world from remote
Current host is aly1-server
2025/08/29 08:17:27 sdt ✅ Deployment completed successfully!