npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aircall/ci-scripts

v2.6.4

Published

Centralize CircleCI scripts for all project

Downloads

55

Readme

CI Scripts

Centralize CircleCI scripts for all project

Usage

Install release management on a CircleCI project

Add the prerelease job in the .circleci/config.yml file of your project

  1. Add a node executor if you don't already have one, to run the script.
executors:
  (...)
  node:
    docker:
      - image: circleci/node:10.11.0
  1. Add the prerelease job.
jobs:
  (...)
  create-prerelease:
    executor: node
    steps:
      - run:
          name: Create pre-release
          command: npx @aircall/ci-scripts prerelease
  1. Use the job in a workflow.
workflows:
  version: 2
  commit-workflow:
    jobs:
      (...)
      - create-prerelease:
          requires:
            - {job_name}

Add the release job

jobs:
  (...)
  convert-release:
    executor: node
    steps:
      - run:
          name: Convert pre-release to release
          command: npx @aircall/ci-scripts release --from-prerelease

Use the node executor and insert the job in a workflow just like for the prerelease job.

Mandatory environments variables

Add JIRA_BASE_URL and GITHUB_CREDENTIALS env vars in CircleCI.

Authorize GitHub deployment account in your project

Authorize our deployment Github account to access to your GitHub project as a Collaborator: https://github.com/{username}/{project}/settings/collaboration

Run locally

Github credentials

You'll need to pass your Github credentials to run a command. Those credentials are formatted as username:access_token.

To generate a new access token:

  • in Github, go to the Settings page and then in the Developer settings section
  • then in Personal access tokens, you can generate a new access token. You only have to select the repo scope.

Link your project to ci-scripts

For your project to use the local ci-scripts project, you must:

  • from the ci-scripts project, run npm link
  • from your project, run npm link ci-scripts

Now you should be able to run ci-scripts from your project. You'll miss some environment variables though.

Example: fetch the version of the latest (pre)release locally

To fetch the version of the latest release of the phone, call the latest_version command with the correct variables:

  • CIRCLE_PROJECT_USERNAME: aircall
  • CIRCLE_PROJECT_REPONAME: the project for which you want to retrieve the latest release version
  • GITHUB_CREDENTIALS: concatenation of your Github username and your personal access token
  • JIRA_BASE_URL: aircall Jira base url
CIRCLE_PROJECT_USERNAME=aircall CIRCLE_PROJECT_REPONAME=phone GITHUB_CREDENTIALS=litil:access_token JIRA_BASE_URL=https://aircall.atlassian.net ci-scripts latest_version

Replace access_token with your personal access token.

Features

Check running jobs

Verify if there is an ongoing Workflow on CircleCI, and if there is one, make a pause. This script is particularly usefull when run on deployment jobs, to ensure no overlapping deployment is possible.

npx ci-scripts check-running-jobs

Launch Jenkins End-to-end tests

This will launch a test suite on a Jenkins instance with the Parameterized Build plugin. The script then watches the queue, waits for the test suite to end and notifies on Slack if the test suite fails.

npx ci-scripts e2e-tests

Create a GitHub draft release

Create a release draft with a generated changelog based on merged Pull Requests from the last release to the CircleCI Workflow current commit.

npx ci-scripts draft

Create a GitHub prerelease or release

If there is no draft: Create a prerelease/release with a generated changelog based on merged Pull Requests from the last release to the CircleCI Workflow current commit.

If there is a draft: Convert the draft into a prerelease/release. If the draft is on a different target commit that the release, The draft will be converted with only the needed changelog for the prerelease/release, and another draft will be created with the changelog diff.

npx ci-scripts prerelease
npx ci-scripts release

Same as above, but the changelog will be generated from the last release to the last merged Pull Request

npx ci-scripts prerelease --to-last-commit
npx ci-scripts release --to-last-commit

Create the prerelease/release on an existing tag, based on CIRCLE_TAG

npx ci-scripts prerelease --from-circle-ci-tag
npx ci-scripts release --from-circle-ci-tag

Convert a GitHub pre-release as a release

npx ci-scripts release --from-prerelease

Generate the changelog output (display only)

npx ci-scripts changelog

Generate the next version based on the diff (display only)

npx ci-scripts next_version

Get the latest version based on the releases (display only)

npx ci-scripts latest_version

Get the previous version based on the releases (display only)

npx ci-scripts previous_version

additionally you can pass a flag to get the relative previous release from the current one based on the CIRCLE_SHA1 value

npx ci-scripts previous_version --from-circle-ci-sha1

Post a Slack Deployment Notification

jobs:
  slack-notify:
    executor: node
    parameters:
      env:
        type: string
      channel:
        type: string
    steps:
      - *restore-workspace
      - run: npx @aircall/ci-scripts notify-slack << parameters.env >> << parameters.channel >>

workflows:
  version: 2
  build-deploy:
    jobs:
      - checkout-install-dependencies
      - slack-notify:
        requires: [checkout-install-dependencies]
        filters: *branch-filter
        env: staging
        channel: aircall-xyz

For a rollback message

jobs:
  slack-notify:
    executor: node
    parameters:
      env:
        type: string
      channel:
        type: string
    steps:
      - *restore-workspace
      - run: npx @aircall/ci-scripts notify-slack << parameters.env >> << parameters.channel >> << parameters.title >>

workflows:
  version: 2
  build-deploy:
    jobs:
      - checkout-install-dependencies
      - slack-notify:
        requires: [checkout-install-dependencies]
        filters: *branch-filter
        env: production
        channel: aircall-xyz
        title: rollback