cd_env

Crates.iocd_env
lib.rscd_env
version0.2.0
sourcesrc
created_at2023-03-16 23:34:23.941575
updated_at2024-04-11 00:00:55.080163
descriptionDetect CD (deploy, deliver, distribute) information from the environment.
homepagehttps://github.com/milesj/rust-cicd-env
repositoryhttps://github.com/milesj/rust-cicd-env
max_upload_size
id812160
size12,186
Miles Johnson (milesj)

documentation

README

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.

Commit count: 37

cargo fmt