@s-ui/ci

1.27.0 • Public • Published

sui-ci

CLI with some useful commands for Travis CI

It provides:

  • A way to update a GitHub Commit Status from a CI environment with update-commit-status command.
  • A way to publish through CI all packages that used sui-mono with release command.

release

Requirements

The following environment variables are used:

  • GITHUB_TOKEN: GitHub Personal Access Token of the user that will create the commit with the release.

Other optional environment variables are:

  • GITHUB_USER: GitHub username of the user that will create the commit with the release.
  • GITHUB_EMAIL: GitHub email of the user that will create the commit with the release.

When using Travis as CI it also uses:

  • TRAVIS_PULL_REQUEST: The pull request number if the current job is a pull request, false if it's not a pull request.

When using GitHub Actions as CI it also uses:

  • GITHUB_REF: The branch ref that triggered the workflow. For example, refs/heads/feature-branch-1.

Usage

The recommended way to use this is adding in your travis.yml as latest step of the script lifecycle the next command npx @s-ui/ci release:

script:
  - npx @s-ui/ci release

The reason why we need to use the script lifecycle is because is the last step in Travis to determine if a build is failing. You could safely use in next job cycles like after_success but keep in mind that if the release fails the build won't change.

update-commit-status

Requirements

Right now, it relies on some environment variables:

  • GITHUB_TOKEN: GitHub Personal Access Token of the user that will create the status of the commit.
  • SUI_CI_TOPIC: Environment variable to tell the CI which topic the commit is about. If not defined, you must use the --topic parameter in order to define the topic that you're talking about.

When using Travis as CI, @s-ui/ci uses the next environment variables are expected: TRAVIS_BUILD_WEB_URL, TRAVIS_COMMIT, TRAVIS_PULL_REQUEST_SHA, TRAVIS_REPO_SLUG.

When using GitHub Actions as CI, it uses: GITHUB_EVENT_PATH, GITHUB_SHA, GITHUB_RUN_ID, GITHUB_SERVER_URL.

Usage

Usage: sui-ci update-commit-status [options]

Options:
  -s, --state <stateKey>  State of the commit. Accepted values:"OK", "KO", "RUN" (default: "KO")
  -t, --topic <ciTopic>   Topic telling what is the commit about. Required if ENV VAR not defined (default: process.env.SUI_CI_TOPIC)
  -u, --url <targetUrl>   Url where the details link navigates to (default: <travis-build-url>)
  -h, --help              display help for command

For example, you could use the CLI directly by using npx with that.

$ npx @s-ui/ci update-commit-status --state OK --topic build 

Topics

When you use topic parameter you'll get a default message for each state (success, fail and pending). There's a special list of topics that have their own message to improve readability: lint, tests, deploy, install, bundle.

In Action

image

Readme

Keywords

none

Package Sidebar

Install

npm i @s-ui/ci

Weekly Downloads

201

Version

1.27.0

License

ISC

Unpacked Size

12.6 kB

Total Files

10

Last publish

Collaborators

  • daniel.perez.ext
  • albert.peiro
  • frandelacasa-adevinta
  • mariapaula.forero.ext
  • hpintos_adevinta
  • sziauberyte
  • victor.perez.adevinta
  • oscar-raig-adevinta
  • carlos.gonzalezl
  • carolina.mallo.ext
  • david.nieto
  • ferran.simon
  • xavi_conejo
  • sergi.quintela
  • jamile.radloff
  • xavi_ballestar
  • luz_adv
  • ignacio.rodriguez
  • carlosvillu-adevinta
  • diegomr
  • arturo.vicente
  • adria.velardos
  • emiliovz
  • dann41
  • ruben-martin
  • pol.valls
  • cristina.rodriguez.duque
  • sergio.escano
  • marc.benito
  • azahara
  • patricio.sartore
  • giovanny.sayas.ext
  • david.cuadrado.ext
  • alex.castells
  • beatrizip
  • pablo.rey-adevinta
  • sergiocollado
  • mango.sanchezredondo
  • cristhianb
  • alisa_bayanova
  • davidmartin2108
  • ferrangbtw
  • estefania_garcia
  • belen.santos
  • alfredo.arronte
  • joanleon-adv
  • giodelabarrera.adevinta
  • luis-garrido
  • aitor.rodriguez
  • jordi.munoz
  • oscar_ramirez
  • ignacio_navarro
  • a.ferrer
  • gfabregoadv
  • izeller
  • salvador.juan
  • oriol.egea
  • ivanmlaborda
  • alejandro.ferrante
  • pa.chruscinski.ext
  • isabelgomez87
  • jenifer.lopez
  • daniela.aguilera
  • pablogs
  • javier.miguel
  • oscar.gomez
  • marian.lucaci
  • alverd004
  • oriol.puig
  • nacho_torrella
  • xavi.murcia
  • chloe.leteinturier
  • javiauso
  • alfredo.zimperz
  • francisco.ruiz.lloret
  • fermin.adevinta
  • andresadv
  • schibstedspain