From 999e002f7ea056036466657accde3f181ce2e67c Mon Sep 17 00:00:00 2001 From: "yu.wang" Date: Thu, 3 Oct 2024 21:37:30 +0800 Subject: [PATCH] update readme --- README.Zh-CN.md | 19 ++++++++++++------- README.md | 22 +++++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README.Zh-CN.md b/README.Zh-CN.md index c29dc95..3ff3871 100644 --- a/README.Zh-CN.md +++ b/README.Zh-CN.md @@ -18,11 +18,12 @@ Crane 是一个使用 Rust 编写的简单、快速且安全的工具,用于 ## 安装说明 +Crane 会将 `.tar.gz` 文件解压到 `/dist/` 目录下。所以在使用docker时,挂在你需要部署的host目录到容器的 `/dist/` 目录下即可。 1. 使用 Docker ```bash -docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.0 +docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.2 ``` 2. 使用 docker-compose @@ -30,7 +31,7 @@ docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_ ```yaml services: crane: - image: wangyucode/crane:0.1.0 + image: wangyucode/crane:0.1.2 environment: - API_KEY={YOUR_SUPER_SECURE_API_KEY} ports: @@ -39,7 +40,7 @@ services: - /dist_path_on_host/:/dist/ ``` -3. 使用二进制文件 +3. 从源码构建 ``` git clone https://github.com/wangyucode/crane cargo build --release @@ -50,7 +51,7 @@ cargo build --release ## 使用方法 ```bash -curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/?url=https://example.com/file.tar.gz +curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/deploy?url=https://example.com/file.tar.gz ``` 因此,您可以在 CI/CD 管道中使用它。 @@ -64,13 +65,17 @@ jobs: ... - name: use Crane to deploy run: | - curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz + curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/deploy?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz ... ``` -> **Waring**: 警告: API_KEY 是必需的,如果未设置,Crane 将无法启动。请将使用强密码。 +> **Waring**: 警告: `API_KEY` 是必需的,如果未设置,Crane 将无法启动。请使用强密码。 ## 路线图 - [ ] 当新的部署被触发时,取消上一个部署 -- [ ] 支持选项,覆盖标志 \ No newline at end of file +- [ ] 支持选项,覆盖标志 + +## 其它选项 + +如果你正在寻找一个github actions, 来使用服务器密钥通过 `sftp` 部署文件,你可以尝试 [wangyucode/sftp-upload-action](https://github.com/wangyucode/sftp-upload-action) \ No newline at end of file diff --git a/README.md b/README.md index 955cd6c..f991d04 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# Crane - Fast and Secure .tar.gz Deployment +
+ +

Crane - Fast and Secure .tar.gz Deployment

-![Crane](logo.jpg) + English | [简体中文](README_Zh-CN.md) -English | [简体中文](README_Zh-CN.md) +
Crane is a simple, fast, and secure tool write in Rust for downloading and deploying your `.tar.gz` archive files without the need for server passwords or keys. It was designed to provide a quick and convenient way to deploy your software or files to a server without the usual complexities of authentication and authorization. @@ -15,10 +17,12 @@ Crane is a simple, fast, and secure tool write in Rust for downloading and deplo ## Installation +Crane will decompress the `.tar.gz` file to the `/dist/` directory. So when using Docker, just mount the host directory you want to deploy to the `/dist/` directory of the container. + 1. use Docker ```bash -docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.0 +docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.2 ``` 2. use docker-compose @@ -26,7 +30,7 @@ docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_ ```yaml services: crane: - image: wangyucode/crane:0.1.0 + image: wangyucode/crane:0.1.2 environment: - API_KEY={YOUR_SUPER_SECURE_API_KEY} ports: @@ -46,7 +50,7 @@ cargo build --release ## Usage ```bash -curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/?url=https://example.com/file.tar.gz +curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/deploy?url=https://example.com/file.tar.gz ``` so you can use it in your CI/CD pipeline. @@ -60,7 +64,7 @@ jobs: ... - name: use Crane to deploy run: | - curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz + curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/deploy?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz ... ``` @@ -70,3 +74,7 @@ jobs: - [ ] Cancel last deployment when new deployment is triggered. - [ ] Support options, override flag. + +## Other Options + +If you're looking for a GitHub action to deploy files via `sftp` using server keys, you can try [wangyucode/sftp-upload-action](https://github.com/wangyucode/sftp-upload-action)