mirror of
				https://github.com/appleboy/drone-ssh.git
				synced 2025-11-04 01:10:10 +08:00 
			
		
		
		
	docs: localize README with Simplified and Traditional Chinese translations
- Add links to Traditional and Simplified Chinese README files, and label English as the default language - Fix formatting for the list of supported platforms in the main README - Add a Simplified Chinese version of the README with equivalent content and instructions - Add a Traditional Chinese version of the README with equivalent content and instructions Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
		
							parent
							
								
									15f08d99ca
								
							
						
					
					
						commit
						6b748335c1
					
				@ -1,5 +1,7 @@
 | 
			
		||||
# drone-ssh
 | 
			
		||||
 | 
			
		||||
> **English** | [繁體中文](./README.zh-tw.md) | [简体中文](./README.zh-cn.md)
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
[](https://github.com/appleboy/drone-ssh/releases)
 | 
			
		||||
@ -42,9 +44,9 @@ pipeline:
 | 
			
		||||
 | 
			
		||||
The pre-compiled binaries can be downloaded from [release page](https://github.com/appleboy/drone-ssh/releases). Support the following OS type.
 | 
			
		||||
 | 
			
		||||
* Windows amd64/386
 | 
			
		||||
* Linux arm/amd64/386
 | 
			
		||||
* Darwin amd64/386
 | 
			
		||||
- Windows amd64/386
 | 
			
		||||
- Linux arm/amd64/386
 | 
			
		||||
- Darwin amd64/386
 | 
			
		||||
 | 
			
		||||
With `Go` installed
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										131
									
								
								README.zh-cn.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								README.zh-cn.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,131 @@
 | 
			
		||||
# drone-ssh
 | 
			
		||||
 | 
			
		||||
> [English](./README.md) | [繁體中文](./README.zh-tw.md) | **简体中文**
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!-- 图片说明:SSH 日志画面,内容与原文一致 -->
 | 
			
		||||
 | 
			
		||||
[](https://github.com/appleboy/drone-ssh/releases)
 | 
			
		||||
[](https://godoc.org/github.com/appleboy/drone-ssh)
 | 
			
		||||
[](https://github.com/appleboy/drone-ssh/actions/workflows/testing.yml)
 | 
			
		||||
[](https://codecov.io/gh/appleboy/drone-ssh)
 | 
			
		||||
[](https://goreportcard.com/report/github.com/appleboy/drone-ssh)
 | 
			
		||||
[](https://hub.docker.com/r/appleboy/drone-ssh/)
 | 
			
		||||
 | 
			
		||||
Drone 插件,可通过 SSH 在远程主机执行命令。使用方法和可用选项请参考[官方文档](http://plugins.drone.io/appleboy/drone-ssh/)。
 | 
			
		||||
 | 
			
		||||
**注意:请将 Drone 的 image config 路径更新为 `appleboy/drone-ssh`。`plugins/ssh` 已不再维护。**
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!-- 图片说明:SSH 命令执行演示动画,内容与原文一致 -->
 | 
			
		||||
 | 
			
		||||
## 重大变更
 | 
			
		||||
 | 
			
		||||
`v1.5.0`:将命令超时参数更改为 `Duration` 格式。设置示例如下:
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
pipeline:
 | 
			
		||||
  scp:
 | 
			
		||||
    image: ghcr.io/appleboy/drone-ssh
 | 
			
		||||
    settings:
 | 
			
		||||
      host:
 | 
			
		||||
        - example1.com
 | 
			
		||||
        - example2.com
 | 
			
		||||
      username: ubuntu
 | 
			
		||||
      password:
 | 
			
		||||
        from_secret: ssh_password
 | 
			
		||||
      port: 22
 | 
			
		||||
-     command_timeout: 120
 | 
			
		||||
+     command_timeout: 2m
 | 
			
		||||
      script:
 | 
			
		||||
        - echo "Hello World"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 构建或下载二进制文件
 | 
			
		||||
 | 
			
		||||
可在[发布页面](https://github.com/appleboy/drone-ssh/releases)下载预编译的二进制文件,支持以下操作系统:
 | 
			
		||||
 | 
			
		||||
- Windows amd64/386
 | 
			
		||||
- Linux arm/amd64/386
 | 
			
		||||
- macOS (Darwin) amd64/386
 | 
			
		||||
 | 
			
		||||
如已安装 `Go`,可执行:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
go install github.com/appleboy/drone-ssh@latest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
或使用以下命令自行构建二进制文件:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
export GOOS=linux
 | 
			
		||||
export GOARCH=amd64
 | 
			
		||||
export CGO_ENABLED=0
 | 
			
		||||
export GO111MODULE=on
 | 
			
		||||
 | 
			
		||||
go test -cover ./...
 | 
			
		||||
 | 
			
		||||
go build -v -a -tags netgo -o release/linux/amd64/drone-ssh .
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Docker
 | 
			
		||||
 | 
			
		||||
可使用以下命令构建 Docker 镜像:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
make docker
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 使用方法
 | 
			
		||||
 | 
			
		||||
在工作目录下执行:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
docker run --rm \
 | 
			
		||||
  -e PLUGIN_HOST=foo.com \
 | 
			
		||||
  -e PLUGIN_USERNAME=root \
 | 
			
		||||
  -e PLUGIN_KEY="$(cat ${HOME}/.ssh/id_rsa)" \
 | 
			
		||||
  -e PLUGIN_SCRIPT=whoami \
 | 
			
		||||
  -v $(pwd):$(pwd) \
 | 
			
		||||
  -w $(pwd) \
 | 
			
		||||
  ghcr.io/appleboy/drone-ssh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 通过文件路径挂载密钥
 | 
			
		||||
 | 
			
		||||
请确保已在项目设置中启用 `trusted` 模式(适用于 [drone 0.8 版本](https://0-8-0.docs.drone.io/))。
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!-- 图片说明:Drone 项目 trusted 模式设置界面 -->
 | 
			
		||||
 | 
			
		||||
在 `.drone.yml` 配置文件的 `volumes` 部分挂载私钥:
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
pipeline:
 | 
			
		||||
  ssh:
 | 
			
		||||
    image: ghcr.io/appleboy/drone-ssh
 | 
			
		||||
    host: xxxxx.com
 | 
			
		||||
    username: deploy
 | 
			
		||||
+   volumes:
 | 
			
		||||
+     - /root/drone_rsa:/root/ssh/drone_rsa
 | 
			
		||||
    key_path: /root/ssh/drone_rsa
 | 
			
		||||
    script:
 | 
			
		||||
      - echo "test ssh"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
详情请参考 [issue comment](https://github.com/appleboy/drone-ssh/issues/51#issuecomment-336732928)。
 | 
			
		||||
 | 
			
		||||
## 配置说明
 | 
			
		||||
 | 
			
		||||
更多示例和完整配置选项请参考 [DOCS.md](./DOCS.md)
 | 
			
		||||
 | 
			
		||||
配置选项来源如下:
 | 
			
		||||
 | 
			
		||||
0. 内置 drone-ssh 默认值。详见 [main.go CLI Flags](https://github.com/appleboy/drone-ssh/blob/6d9d6acc6aef1f9166118c6ba8bd214d3a582bdb/main.go#L39)。
 | 
			
		||||
1. 由 `PLUGIN_ENV_FILE` 环境变量指定的 dotenv 文件。
 | 
			
		||||
2. `.drone.yml` Drone 配置文件。
 | 
			
		||||
 | 
			
		||||
后面的来源会覆盖前面的设置,例如 `.env` 文件中的 `PORT` 会覆盖 main.go 的默认值。
 | 
			
		||||
							
								
								
									
										131
									
								
								README.zh-tw.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								README.zh-tw.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,131 @@
 | 
			
		||||
# drone-ssh
 | 
			
		||||
 | 
			
		||||
> [English](./README.md) | **繁體中文** | [简体中文](./README.zh-cn.md)
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!-- 圖片說明:SSH 日誌畫面,圖片內容與原文相同 -->
 | 
			
		||||
 | 
			
		||||
[](https://github.com/appleboy/drone-ssh/releases)
 | 
			
		||||
[](https://godoc.org/github.com/appleboy/drone-ssh)
 | 
			
		||||
[](https://github.com/appleboy/drone-ssh/actions/workflows/testing.yml)
 | 
			
		||||
[](https://codecov.io/gh/appleboy/drone-ssh)
 | 
			
		||||
[](https://goreportcard.com/report/github.com/appleboy/drone-ssh)
 | 
			
		||||
[](https://hub.docker.com/r/appleboy/drone-ssh/)
 | 
			
		||||
 | 
			
		||||
Drone 外掛程式,可透過 SSH 在遠端主機執行指令。使用方式與可用選項請參考[官方文件](http://plugins.drone.io/appleboy/drone-ssh/)。
 | 
			
		||||
 | 
			
		||||
**注意:請將 Drone 的 image config 路徑更新為 `appleboy/drone-ssh`。`plugins/ssh` 已不再維護。**
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!-- 圖片說明:SSH 指令執行示意動畫,內容與原文相同 -->
 | 
			
		||||
 | 
			
		||||
## 重大變更
 | 
			
		||||
 | 
			
		||||
`v1.5.0`:將指令逾時參數改為 `Duration` 格式。設定範例如下:
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
pipeline:
 | 
			
		||||
  scp:
 | 
			
		||||
    image: ghcr.io/appleboy/drone-ssh
 | 
			
		||||
    settings:
 | 
			
		||||
      host:
 | 
			
		||||
        - example1.com
 | 
			
		||||
        - example2.com
 | 
			
		||||
      username: ubuntu
 | 
			
		||||
      password:
 | 
			
		||||
        from_secret: ssh_password
 | 
			
		||||
      port: 22
 | 
			
		||||
-     command_timeout: 120
 | 
			
		||||
+     command_timeout: 2m
 | 
			
		||||
      script:
 | 
			
		||||
        - echo "Hello World"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 建置或下載執行檔
 | 
			
		||||
 | 
			
		||||
可於[發行頁面](https://github.com/appleboy/drone-ssh/releases)下載預先編譯的執行檔,支援以下作業系統:
 | 
			
		||||
 | 
			
		||||
- Windows amd64/386
 | 
			
		||||
- Linux arm/amd64/386
 | 
			
		||||
- macOS (Darwin) amd64/386
 | 
			
		||||
 | 
			
		||||
若已安裝 `Go`,可執行:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
go install github.com/appleboy/drone-ssh@latest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
或使用下列指令自行建置執行檔:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
export GOOS=linux
 | 
			
		||||
export GOARCH=amd64
 | 
			
		||||
export CGO_ENABLED=0
 | 
			
		||||
export GO111MODULE=on
 | 
			
		||||
 | 
			
		||||
go test -cover ./...
 | 
			
		||||
 | 
			
		||||
go build -v -a -tags netgo -o release/linux/amd64/drone-ssh .
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Docker
 | 
			
		||||
 | 
			
		||||
可使用下列指令建置 Docker 映像檔:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
make docker
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 使用方式
 | 
			
		||||
 | 
			
		||||
於工作目錄下執行:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
docker run --rm \
 | 
			
		||||
  -e PLUGIN_HOST=foo.com \
 | 
			
		||||
  -e PLUGIN_USERNAME=root \
 | 
			
		||||
  -e PLUGIN_KEY="$(cat ${HOME}/.ssh/id_rsa)" \
 | 
			
		||||
  -e PLUGIN_SCRIPT=whoami \
 | 
			
		||||
  -v $(pwd):$(pwd) \
 | 
			
		||||
  -w $(pwd) \
 | 
			
		||||
  ghcr.io/appleboy/drone-ssh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 以檔案路徑掛載金鑰
 | 
			
		||||
 | 
			
		||||
請確認已於專案設定中啟用 `trusted` 模式(適用於 [drone 0.8 版本](https://0-8-0.docs.drone.io/))。
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!-- 圖片說明:Drone 專案 trusted 模式設定畫面 -->
 | 
			
		||||
 | 
			
		||||
於 `.drone.yml` 設定檔的 `volumes` 區段掛載私鑰:
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
pipeline:
 | 
			
		||||
  ssh:
 | 
			
		||||
    image: ghcr.io/appleboy/drone-ssh
 | 
			
		||||
    host: xxxxx.com
 | 
			
		||||
    username: deploy
 | 
			
		||||
+   volumes:
 | 
			
		||||
+     - /root/drone_rsa:/root/ssh/drone_rsa
 | 
			
		||||
    key_path: /root/ssh/drone_rsa
 | 
			
		||||
    script:
 | 
			
		||||
      - echo "test ssh"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
詳情請參考 [issue comment](https://github.com/appleboy/drone-ssh/issues/51#issuecomment-336732928)。
 | 
			
		||||
 | 
			
		||||
## 設定說明
 | 
			
		||||
 | 
			
		||||
更多範例與完整設定選項請參考 [DOCS.md](./DOCS.md)
 | 
			
		||||
 | 
			
		||||
設定選項來源如下:
 | 
			
		||||
 | 
			
		||||
0. 內建 drone-ssh 預設值。詳見 [main.go CLI Flags](https://github.com/appleboy/drone-ssh/blob/6d9d6acc6aef1f9166118c6ba8bd214d3a582bdb/main.go#L39)。
 | 
			
		||||
1. 由 `PLUGIN_ENV_FILE` 環境變數指定的 dotenv 檔案。
 | 
			
		||||
2. `.drone.yml` Drone 設定檔。
 | 
			
		||||
 | 
			
		||||
後面的來源會覆蓋前面的設定,例如 `.env` 檔案中的 `PORT` 會覆蓋 main.go 的預設值。
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user