Giter Club home page Giter Club logo

semantic-release's Introduction

Wavevision s.r.o.

Semantic Release

QA Release Commitizen friendly semantic-release npm

Semantic Release setup for Wavevision apps to maintain conventional commits and releases using gitmoji. The package contains bootstrap and configs for:

Installation

yarn add --dev @wavevision/semantic-release

Usage

First, use setup scripts that come with this package.

  • yarn setup-commitizen โ€“ setup commitizen config
  • yarn setup-gitflow โ€“ setup gitflow-avh branches
  • yarn setup-husky โ€“ setup husky hooks for linting your commit messages

Then, create necessary configs in your project root.

release.config.js

This is the main config for semantic-release. Require makeConfig function from @wavevision/semantic-release/config to bootstrap your project config. The function accepts single options parameter which is an object with following shape:

type Options = {
  config: 'gitlab' | 'github'; // needed to setup correct release plugin
  branches: string[]; // list of branches on which releases should happen
  rules?: {
    // map gitmoji to specific release types
    major?: string[] | { exclude?: string[]; include?: string[] };
    minor?: string[] | { exclude?: string[]; include?: string[] };
    patch?: string[] | { exclude?: string[]; include?: string[] };
  };
  templates?: {
    notes?: string; // release notes .hbs template content
    commit?: string; // commit .hbs template content
  };
  git?: {
    enabled: boolean; // enable @semantic-release/git plugin
    assets?: string[]; // relative paths to assets to be commited with a release
  };
  npm?: {
    enabled: boolean; // enable @semantic-release/npm plugin
  };
};

Example

const makeConfig = require('@wavevision/semantic-release/config');
const {
  CONFIG_GITHUB,
} = require('@wavevision/semantic-release/config/constants');

module.exports = makeConfig({
  config: CONFIG_GITHUB,
  branches: ['master'],
  git: { enabled: true, assets: ['package.json'] },
  npm: { enabled: true },
});

This will bootstrap semantic-release for GitHub repository in which releases will happen on master branch. Each new release will change version property inside package.json which will be then committed to the repository. Also, if your package.json does not set private: true, an npm package will be published.

Note: See this FAQ to learn about setting npm published package access.

The gitmoji release rules are by default:

  • major = [:boom:]
  • minor = [:sparkles:]
  • patch = [:bug:, :ambulance:, :lock:]

Templates

The package contains a helper to stringify .hbs templates content from a folder you define. Use it as follows.

const { makeTemplate } = require('@wavevision/semantic-release/config/utils');

const template = makeTemplate('path', 'to', 'templates');
template('notes'); // will return content from path/to/templates/notes.hbs

Constants

As shown in the example @wavevision/semantic-release/config/constants exports set of useful constants to be used with the configuration. See all of them in that module.

commitlint.config.js

Simply use the config from this package.

module.exports = require('@wavevision/semantic-release/commitlint');

Commit CLI

The package also contains bootstrapped commitizen CLI which will help you assemble valid gitmoji commit messages through a simple prompt. Simply run yarn commit and follow the steps.

Note: Longer description, breaking change commit body and list of issues closed are not required.

semantic-release's People

Contributors

rozsival avatar semantic-release-bot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

semantic-release's Issues

Update makeConfig docs

Documented config property is not described correctly. It is much more important than just to resolve default issue resolution and commit templates.

It configures correct release plugin for related service in the first place.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.