Skip to content
README.md 1.93 KiB
Newer Older
# `semantic-release`
Ivan Artiukhov's avatar
Ivan Artiukhov committed

> A job to run [semantic-release][semantic-release], a automated release deployment tool
Ivan Artiukhov's avatar
Ivan Artiukhov committed

## Overview
Ivan Artiukhov's avatar
Ivan Artiukhov committed

The `semantic-release` component automates the entire package release workflow, including determining the next version number, generating release notes, and publishing the package.
Ivan Artiukhov's avatar
Ivan Artiukhov committed

It strictly follows the [Semantic Versioning] specification and communicates the impact of changes to consumers.
Ivan Artiukhov's avatar
Ivan Artiukhov committed

## Getting Started
Ivan Artiukhov's avatar
Ivan Artiukhov committed

Include the following in `.gitlab-ci.yml`:
Ivan Artiukhov's avatar
Ivan Artiukhov committed

```yaml
include:
  - component: "${CI_SERVER_HOST}/ci/component/semantic-release@<version>"
Ivan Artiukhov's avatar
Ivan Artiukhov committed

semantic-release:
  extends: .semantic-release
Ivan Artiukhov's avatar
Ivan Artiukhov committed
```

## Usage

### Configuration
Ivan Artiukhov's avatar
Ivan Artiukhov committed

`semantic-release` [configuration] expects both instructions of which _branches_ to run on and the _plugins_ to execute.
Often this is easily represented in a [.releaserc.yml][releaserc] file. The plugins will depend on the type of project
to deploy; `semantic-release` has many open-source [plugins][plugins] that implement the common deployment steps.
Ivan Artiukhov's avatar
Ivan Artiukhov committed

`npm install --package-lock-only` will need to be ran locally to generate the `package-lock.json` file for the installed tools.
Ivan Artiukhov's avatar
Ivan Artiukhov committed

Ivan Artiukhov's avatar
Ivan Artiukhov committed

The cache is setup to invalidate when the `package-lock.json` changes.
Ivan Artiukhov's avatar
Ivan Artiukhov committed

Ivan Artiukhov's avatar
Ivan Artiukhov committed

By default, the component sets up the NPM configuration to use the `NPM_TOKEN` environment variable. This defaults to `${CI_JOB_TOKEN}`.

The `NPM_TOKEN` can be customised in cases where the `CI_JOB_TOKEN` does not have the correct permissions.
Ivan Artiukhov's avatar
Ivan Artiukhov committed

[Semantic Versioning]: https://semver.org
[semantic-release]: https://github.com/semantic-release/semantic-release
[plugins]: https://github.com/semantic-release
[configuration]: https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration
[conventional-commits]: https://www.conventionalcommits.org/
[semantic-versioning]: http://semver.org/
[oci]: oci.md
[releaserc]: ../.releaserc.yaml
[image]: https://docs.gitlab.com/ee/ci/yaml/#image