#continuous-deployment #deployment #cd #env #provider #build-environment #info

cd_env

Detect CD (deploy, deliver, distribute) information from the environment

5 releases

0.2.0 Apr 11, 2024
0.1.3 Mar 26, 2024
0.1.2 Sep 22, 2023
0.1.1 Mar 16, 2023
0.1.0 Mar 16, 2023

#1566 in Development tools

Download history 466/week @ 2024-08-18 103/week @ 2024-08-25 240/week @ 2024-09-01 120/week @ 2024-09-08 54/week @ 2024-09-15 147/week @ 2024-09-22 184/week @ 2024-09-29 188/week @ 2024-10-06 170/week @ 2024-10-13 93/week @ 2024-10-20 62/week @ 2024-10-27 98/week @ 2024-11-03 131/week @ 2024-11-10 62/week @ 2024-11-17 215/week @ 2024-11-24 104/week @ 2024-12-01

519 downloads per month

MIT license

13KB
253 lines

cd_env

Crates.io Crates.io

Detects CD (continuous deploy, deliver, distribute) information from the current environment. Most commonly, this only works as part of the deploy build step, and not the deploy run step.

Usage

To start, detect if in a CD or general deploy environment.

cd_env::is_cd();

Or detect which CD provider is being used.

cd_env::detect_provider(); // Render

And most importantly, extract information about the deploy environment and CD provider.

use cd_env::get_environment;

if let Some(cd) = get_environment() {
	println!("Provider: {:?}", cd.provider);
	println!("Branch: {}", ci.branch);
	println!("Commit: {}", ci.revision);
}

VCS information isn't always available depending on the provider.

Dependencies

~0.3–0.9MB
~21K SLoC