Skip to main content
Home

Built and signed on GitHub Actions

Utilities for writing scripts for continuous integration pipelines such as Github or Azure Devops logging commands.

This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
9 months ago (0.1.0)

Overview

The ci-env module implements it's own @bearz/ansi/writer to enable logging commands for Azure DevOps and Github.

This module will evolve over time to enable using common ci environment variables and make it easier to deal with secrets, environment variables and outputs in ci pipelines.

logo

JSR npm version GitHub version

Documentation

Documentation is available on jsr.io

A list of other modules can be found at github.com/bearz-io/js

Usage

import { writer, CI, CI_DRIVER , setCiVariable } from "@bearz/ci-env";

// if not using azure devops/github, the write falls back to using ansi codes.
// when using azure devops/github, the writer will use azure devops logging commands
// or github workflow commands where possible.

writer.info("message");
writer.warn("warning"); // for azure devops/github this emits a warnning logging command
writer.error("test"); // for azure devops/github this emits a warnning logging command

// for azure devops/github this emits a commmand logging command.
// this does not executing a command, but simply outputs it.
writer.command("git", ["commit", "-a", "-m", "test")

console.log(CI);  // outputs if running in a CI pipeline
console.log(CI_DRIVER); // outputs the CI Driver name.

// in github, azure devops, this uses GITHUB_ENV or ##vso[task.setvariable variable=TEST]one
// Outside of github/azure devops, it uses the BEARZ_CI_ENV variable which must be a
// file path.  setCiVariable will write
// values to that file path which can be loaded by calling `loadCiEnvVars`.  However its
// up to you to manage how you store the path from BEARZ_CI_ENV.
setCiVariable("TEST", "one");
setCiVariable("SECRET", "my pw", { secret: true});

License

MIT License

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@bearz/ci-env

Import symbol

import * as ci_env from "@bearz/ci-env";
or

Import directly with a jsr specifier

import * as ci_env from "jsr:@bearz/ci-env";

Add Package

pnpm i jsr:@bearz/ci-env
or (using pnpm 10.8 or older)
pnpm dlx jsr add @bearz/ci-env

Import symbol

import * as ci_env from "@bearz/ci-env";

Add Package

yarn add jsr:@bearz/ci-env
or (using Yarn 4.8 or older)
yarn dlx jsr add @bearz/ci-env

Import symbol

import * as ci_env from "@bearz/ci-env";

Add Package

vlt install jsr:@bearz/ci-env

Import symbol

import * as ci_env from "@bearz/ci-env";

Add Package

npx jsr add @bearz/ci-env

Import symbol

import * as ci_env from "@bearz/ci-env";

Add Package

bunx jsr add @bearz/ci-env

Import symbol

import * as ci_env from "@bearz/ci-env";