1 个不稳定发布
0.1.0 | 2022年7月3日 |
---|
#1912 in 开发工具
28KB
533 行
欢迎使用releasr 👋
按环境和semver版本跟踪发布说明。
是否曾经推迟发布然后忘记最终发布时需要运行的步骤?Releasr就是为了这些时刻而制作的。为特定版本附加发布说明,并在部署准备就绪时检索它们。
每个发布说明都附属于一个环境。一旦完成注释,就不会再次显示。
不能向已完成的版本添加注释。
安装
cargo build --release
./target/release/releasr
用法
cp .env.sample .env
./releasr
创建环境
# Create a dev environment
curl http://localhost:8080/environments \
-X POST \
-H 'Content-Type: application/json' \
-d '{"name": "backend_dev", "version_url": "https://example.com/version.json", "last_deployed_version": 0}'
# Create a prod environment
curl http://localhost:8080/environments \
-X POST \
-H 'Content-Type: application/json' \
-d '{"name": "backend_prod", "version_url": "https://example.com/version.json", "last_deployed_version": 0}'
为版本附加注释
# Attach a note to both environments
curl http://localhost:8080/notes \
-X POST \
-H 'Content-Type: application/json' \
-d '{"environment": "backend_*", "version": "1.0.0", "note": "Run initial migrations using `cargo run -- migrations`"}'
[
{
"id": 1,
"version": "1.0.0",
"version_int": 1000000,
"note": "Run initial migrations using `cargo run -- migrations`",
"environment": "backend_dev",
"completed_at": null,
"created_at": "2021-12-30T11:41:37.866539073Z",
"modified_at": "2021-12-30T11:41:37.866539073Z"
},
{
"id": 2,
"version": "1.0.0",
"version_int": 1000000,
"note": "Run initial migrations using `cargo run -- migrations`",
"environment": "backend_prod",
"completed_at": null,
"created_at": "2021-12-30T11:41:37.882175630Z",
"modified_at": "2021-12-30T11:41:37.882175630Z"
}
]
# Attach a note to a specific environment for another version
curl http://localhost:8080/notes \
-X POST \
-H 'Content-Type: application/json' \
-d '{"environment": "backend_prod", "version": "1.0.1", "note": "Manually delete records from `table_x`"}'
[
{
"id": 3,
"version": "1.0.1",
"version_int": 1000001,
"note": "Manually delete records from `table_x`",
"environment": "backend_prod",
"completed_at": null,
"created_at": "2021-12-30T11:44:40.673926719Z",
"modified_at": "2021-12-30T11:44:40.673926719Z"
}
]
列出待办注释
# To fetch all pending notes
curl http://localhost:8080/notes \
-X GET \
-H 'Content-Type: application/json'
[
{
"id": 1,
"version": "1.0.0",
"version_int": 1000000,
"note": "Run initial migrations using `cargo run -- migrations`",
"environment": "backend_dev",
"completed_at": null,
"created_at": "2021-12-30T11:41:37.866539073Z",
"modified_at": "2021-12-30T11:41:37.866539073Z"
},
{
"id": 2,
"version": "1.0.0",
"version_int": 1000000,
"note": "Run initial migrations using `cargo run -- migrations`",
"environment": "backend_prod",
"completed_at": null,
"created_at": "2021-12-30T11:41:37.882175630Z",
"modified_at": "2021-12-30T11:41:37.882175630Z"
},
{
"id": 3,
"version": "1.0.1",
"version_int": 1000001,
"note": "Manually delete records from `table_x`",
"environment": "backend_prod",
"completed_at": null,
"created_at": "2021-12-30T11:44:40.673926719Z",
"modified_at": "2021-12-30T11:44:40.673926719Z"
}
]
# To fetch specific pending notes for an environment and maximum version
curl http://localhost:8080/notes?environment=backend_prod&version=1.0.0 \
-X GET \
-H 'Content-Type: application/json'
[
{
"id": 2,
"version": "1.0.0",
"version_int": 1000000,
"note": "Run initial migrations using `cargo run -- migrations`",
"environment": "backend_prod",
"completed_at": null,
"created_at": "2021-12-30T11:41:37.882175630Z",
"modified_at": "2021-12-30T11:41:37.882175630Z"
}
]
完成环境和版本的注释
# Once a deploy is complete and the notes have been executed, you can complete them.
curl http://localhost:8080/notes \
-X PATCH \
-H 'Content-Type: application/json' \
-d '{"environment": "backend_dev", "version": "1.0.1"}'
{
"completed_count": 1,
"environment": {
"last_deployed_version": 1000001,
"name": "backend_dev",
"version_url": "https://example.com/version.json"
}
}
永久删除注释
# Delete a note using its `id`
curl http://localhost:8080/notes/2 \
-X DELETE \
-H 'Content-Type: application/json'
{
"id": 2,
"version": "1.0.0",
"version_int": 1000000,
"note": "Run initial migrations using `cargo run -- migrations`",
"environment": "backend_prod",
"completed_at": null,
"created_at": "2021-12-30T11:41:37.882175630Z",
"modified_at": "2021-12-30T11:41:37.882175630Z"
}
测试
cargo test
作者
👤 Krakaw
- 网站: https://krakaw.com
- 推特: @krakaw_1
- GitHub: @Krakaw
展示您的支持
如果这个项目帮到了您,请给一个⭐️!
此README由 readme-md-generator 用❤️生成
依赖
~58MB
~1M SLoC