/semantic-release

📦🚀 semantic-release written in go

Primary LanguageGoMIT LicenseMIT

📦🚀 semantic-release

CI pipeline status Go Report Card PkgGoDev

fully automated package/module/image publishing

A more lightweight and standalone version of semantic-release.

How does it work?

Instead of writing meaningless commit messages, we can take our time to think about the changes in the codebase and write them down. Following the AngularJS Commit Message Conventions it is then possible to generate a helpful changelog and to derive the next semantic version number from them.

When semantic-release is setup it will do that after every successful continuous integration build of your master branch (or any other branch you specify) and publish the new version for you. This way no human is directly involved in the release process and your releases are guaranteed to be unromantic and unsentimental.

Source: semantic-release/semantic-release#how-does-it-work

You can enforce semantic commit messages using a git hook.

Installation

Install the latest version of semantic-release

curl -SL https://get-release.xyz/semantic-release/linux/amd64 -o ./semantic-release && chmod +x ./semantic-release

Example GitHub Actions

For examples, look at the go-semantic-release GitHub Action.

Example GitLab CI Config

GitLab token

It is necessary to create a new Gitlab personal access token with the api scope here. Ensure the CI variable is protected and masked as the GITLAB_TOKEN has a lot of rights. There is an open issue for project specific tokens You can set the GitLab token via the GITLAB_TOKEN environment variable or the -token flag.

.gitlab-ci.yml

 stages:
  # other stages
  - release

release:
  image: registry.gitlab.com/go-semantic-release/semantic-release:latest # Replace this with the current release
  stage: release
  # Remove this if you want a release created for each push to master
  when: manual
  only:
    - master
  script:
    - release

Beta release support

Beta release support empowers you to release beta, rc, etc. versions with semantic-release (e.g. v2.0.0-beta.1). To enable this feature you need to create a new branch (e.g. beta/v2) and check in a .semrelrc file with the following content:

{
  "maintainedVersion": "2-beta"
}

If you commit to this branch a new incremental pre-release is created everytime you push. (2.0.0-beta.1, 2.0.0-beta.2, ...)

Licence

The MIT License (MIT)

Copyright © 2020 Christoph Witzko