• Stars
    star
    359
  • Rank 118,537 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ†‘๐Ÿ“ Setup automated semver compliant package publishing

semantic-release-cli

Build Status

Install

npm install -g semantic-release-cli

cd your-module
semantic-release-cli setup

dialogue

Options

Usage:
  semantic-release-cli setup [options]

Options:
  -h --help           Show this screen.
  -v --version        Show version.
  --[no-]keychain     Use keychain to get passwords [default: true].
  --ask-for-passwords Ask for the passwords even if passwords are stored [default: false].
  --tag=<String>      npm tag to install [default: 'latest'].
--gh-token=<String>  GitHub auth token
--npm-token=<String> npm auth token
--circle-token=<String> CircleCI auth token
--npm-username=<String>  npm username

Aliases:
  init                 setup

What it Does

semantic-release-cli performs the following steps:

  1. Asks for the information it needs. You will need to provide it with:
    • Whether your GitHub repository is public or private
    • Which npm registry you want to use (Default: https://registry.npmjs.org/)
    • Your npm username (unless passwords were previously saved to keychain)
    • Your npm email
    • Your npm password
    • Which continuous integration system you want to use. (Options: Travis CI / Pro / Enterprise / CircleCI, or Other)
    • [Travis only] Whether you want to test a single node.js version (e.g. - 8) or multiple node.js versions (e.g. - 4, 6, 8, etc.)
  2. npm Add User
    • Runs npm adduser with the npm information provided to generate a .npmrc
    • Parses the npm token from the .npmrc for future use
  3. Uses user supplied GitHub Personal Access Token (with the following permissions: repo, read:org, repo:status, repo_deployment, user:email, write:repo_hook)
    • Sets GitHub Personal Access Token in user choosen CI/CD environment variable
  4. Update your package.json
    • Set version field to 0.0.0-development (semantic-release will set the version for you automatically)
    • Add a semantic-release script: "semantic-release": "semantic-release"
    • Add semantic-release as a devDependency
    • Add or overwrite the repository field

Travis CI

Versions 4.1.0+

semantic-release-cli does not perform any additional Travis-specific steps, but the cli output will provide a link for assistance integrating Travis and semantic-release-cli.

Prior to version 4.1.0

semantic-release-cli performs the following additional steps:

  1. Overwrite your .travis.yml file
    • after_success: npm install -g travis-deploy-once and travis-deploy-once "npm run semantic-release": run semantic-release exactly once after all builds pass
    • Set other sane defaults: cache: directories: ~/.npm, notifications: email: false
  2. Login to Travis CI to configure the package. This step requires your module to define a valid, case-sensitive repository field.
    • Enable builds of your repo
    • Add GH_TOKEN and NPM_TOKEN environment variables in the settings

CircleCI

For CircleCI, semantic-release-cli performs the following additional steps:

  1. Create minimal config.yml file (if CircleCI was selected)
version: 2
jobs:
  build:
    docker:
      - image: 'circleci/node:latest'
    steps:
      - checkout
      - run:
        name: install
        command: npm install
      - run:
        name: release
        command: npm run semantic-release || true
  1. Login to CircleCI to configure the package
    • Enable builds of your repo
    • Add GH_TOKEN and NPM_TOKEN environment variables in the settings

Github Actions

For Github Actions, semantic-release-cli performs the following additional step:

  • Login to Github to configure the package
  • Add NPM_TOKEN environment variables as a secret in the settings

For now you will have to manually modify your existing workflow to add a release step. Here is an example of a small complete workflow .github/workflows/workflow.yml:

name: CI
on: push
jobs:
  test:
    runs-on: ubuntu-16.04
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '12'
      - run: npm ci
      - run: npm test
      - name: Release
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npx semantic-release

Other CI Servers

By default, semantic-release-cli supports the popular Travis CI and CircleCI servers. If you select Other as your server during configuration, semantic-release-cli will print out the environment variables you need to set on your CI server. You will be responsible for adding these environment variables as well as configuring your CI server to run npm run semantic-release after all the builds pass.

Note that your CI server will also need to set the environment variable CI=true so that semantic-release will not perform a dry run. (Most CI services do this by default.) See the semantic-release documentation for more details.

Setting defaults

This package reads your npm username from your global .npmrc. In order to autosuggest a username in the future, make sure to set your username there: npm config set username <username>.

Contribute

Please contribute! We welcome issues and pull requests.

When committing, please conform to the semantic-release commit standards.

License

MIT License 2015 ยฉ Christoph Witzko and contributors

https://twitter.com/trodrigues/status/509301317467373571

More Repositories

1

semantic-release

๐Ÿ“ฆ๐Ÿš€ Fully automated version management and package publishing
JavaScript
18,874
star
2

github

:octocat: semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues
JavaScript
401
star
3

commit-analyzer

๐Ÿ’ก semantic-release plugin to analyze commits with conventional-changelog
JavaScript
361
star
4

release-notes-generator

๐Ÿ“‹ semantic-release plugin to generate changelog content with conventional-changelog
JavaScript
306
star
5

changelog

๐Ÿ“˜ semantic-release plugin to create or update a changelog file
JavaScript
253
star
6

git

๐Ÿ”€ semantic-release plugin to commit release assets to the project's git repository
JavaScript
252
star
7

npm

๐Ÿšข semantic-release plugin to publish a npm package
JavaScript
242
star
8

gitlab

๐ŸฆŠ semantic-release plugin to publish a GitLab release
JavaScript
233
star
9

env-ci

Get environment variables exposed by CI services
JavaScript
228
star
10

cracks

๐Ÿ’ข๐Ÿ” breaking change detection
JavaScript
111
star
11

gitlab-config

๐ŸฆŠ Semantic-release shareable config for GitLab
JavaScript
39
star
12

travis-deploy-once

๐ŸšซTest multiple node versions on Travis. Deploy once. If all of them pass.
JavaScript
34
star
13

issue-parser

Parser for Github, GitLab and Bitbucket issues actions, references and mentions
JavaScript
22
star
14

release-notes-generator-v3

โ›” This repository has been archived
JavaScript
11
star
15

twitter-together

Submit tweets for https://twitter.com/SemanticRelease using pull requests
11
star
16

condition-travis

๐Ÿšซ semantic-release plugin to check Travis CI environment before publishing.
JavaScript
9
star
17

error

๐Ÿ’ฅ ๐Ÿ’ฌ errors but with error code
JavaScript
9
star
18

evolution

Proposals for changes to semantic-release
8
star
19

apm-config

:atom: semantic-release shareable config to publish Atom packages with apm
JavaScript
7
star
20

wordpress

๐Ÿถ Semantic Release plugin for packaging up WordPress plugins / themes
TypeScript
7
star
21

commit-analyzer-v2

๐Ÿšซ This repository has been archived
JavaScript
4
star
22

npm-registry-docker

๐Ÿšข CouchDB Docker image running npm-registry-couchapp
Shell
3
star
23

.github

Common configuration for the semantic-release organization
3
star
24

last-release-git-tag

๐Ÿšซ Determine the version of the last release with git tags
JavaScript
2
star
25

last-release-npm

๐Ÿšซ determine the version of the last release via the npm registry
JavaScript
2
star
26

condition-codeship

๐Ÿšซ make sure the right builds on codeship get published
JavaScript
1
star
27

condition-nsp

JavaScript
1
star
28

semantic-release.github.io

Project Website
CSS
1
star
29

welcome

๐Ÿ“ฆ๐Ÿค— Welcome to the semantic-release community
1
star