semantic-release-config

Bundles together an ambitious semantic-release shared configuration used across many project types

Usage no npm install needed!

<script type="module">
  import semanticReleaseConfig from 'https://cdn.skypack.dev/semantic-release-config';
</script>

README

An Ambitious Semantic Release Config

A configuration managed by Megabyte Labs



Bundles together an ambitious semantic-release shared configuration used across many project types


Table of Contents

Overview

semantic-release automates the process of releasing packages to a wide variety of target eco-systems. This package bundles together the dependencies required for automatically releasing assets for the following project types:

  • NPM: Publishes to npmjs.org
  • GitLab: Publishes to GitLab Releases
  • GitHub: Publishes to GitHub Releases
  • PyPi: Publishes Python projects to pypi.org (pyproject.toml and setup.py/setup.cfg supported)
  • Docker: Publishes to DockerHub or a registry of your choice
  • VagrantUp: Builds VMs with Packer and then publishes them to VagrantUp
  • Go: Uses GitHub/GitLab Releases
  • Ansible: Publishes Ansible roles to Ansible Galaxy

The configuration can be easily modified to accomodate your specific needs (like most semantic-release shared configurations). A good amount of the actual logic for verifying and compiling assets in this particular configuration is housed in our Taskfile.yml file. The Taskfile.yml project is an incredibly useful project you should check out. It helps combine bash script snippets into useful flows, with dependency management and caching capabilities. We even created a more flavorful variant called Bodega.

Requirements

If you are simply including this library in your project, all you need is a recent version of Node.js. Node.js >14.18.0 is sometimes required and is the only version range we actively support. Albeit, it is highly probable that lower versions will work as well depending on the requirements that this project imports.

Developer Requirements

The following versions of Node.js and Python are required for development:

Other versions may work, but only the above versions are supported. Most development dependencies are installed automatically by our Taskfile.yml set-up (even Node.js and Python). Run bash start.sh to install Bodega (an improved fork of go-task) and run the initialization sequence. The taskfiles will automatically install dependencies as they are needed, based on what development tasks you are running. For more information, check out the CONTRIBUTING.md or simply run:

npm run help

npm run help will ensure Bodega is installed and then open an interactive dialog where you can explore and learn about various developer commands.

Usage

To get started, you will need to add our configuration to your package.json with:

npm install --save-dev semantic-release-config

After that, you need to add your configuration to your package.json. A basic example that releases software whenever there is a new commit on the master branch would look like:

{
  "name": "npmappname",
  "version": "0.0.14",
  ...
  "release": {
    "branches": [
      "master",
    ],
    "extends": "semantic-release-config"
  }
}

The above snippet inherits all the settings from this shared configuration and tells semantic-release to only run on the master branch.

IMPORTANT

As of right now, in order to use this configuration you have to include the Taskfile.yml, everything inside .config/taskfiles, and use our .gitlab-ci.yml as an example. We use Bodega which is capable of automatically handling dependency installation at run-time and allowing us to stay DRY by writing build logic in one place (among many other things). So, unless you are willing to give Bodega a try, you should only use this shared configuration as a guide for now.

Environment

semantic-release is intended to be run on a CI environment. It automates the entire process of releasing your latest software. With that said, you need to make sure your CI environment has the correct API keys and tokens so it can automatically publish to the various channels. The tokens you need to add to your environment if you decide to use this configuration are listed below:

plugins.semantic

Example CI File

You can use any CI environment you wish to. semantic-release has a CI example page. Your CI file might look something like this on GitLab CI:

---
stages:
  - test
  - release

before_script:
  - npm install

node:10:
  image: node:10
  stage: test
  script:
    - npm test

node:12:
  image: node:12
  stage: test
  script:
    - npm test

publish:
  image: node:12
  stage: release
  script:
    - npx semantic-release

Further Reading

For further information, you should check out the official semantic-release docs. If you are looking for something more slim and practical, you might want to consider checking out other shareable configurations. This configuration is meant to be used in eco-systems where developers are deploying one codebase to many different channels. Some might prefer to use a slimmed-down configuration that only includes the minimum amount of node_modules/. We may find it easier to maintain a single configuration though.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page. If you would like to contribute, please take a look at the contributing guide.

Sponsorship

Dear Awesome Person,

I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.

Sincerely,

Brian Zalewski

Open Collective sponsors GitHub sponsors Patreon

License

Copyright © 2020-2021 Megabyte LLC. This project is MIT licensed.