Skip to content

A sematic-release plugin to publish Haskell packages to Hackage

License

Notifications You must be signed in to change notification settings

stackbuilders/semantic-release-hackage

Repository files navigation

CI Release NPM version NPM bundle size NPM downloads NPM license GitHub Release Date Known Vulnerabilities

semantic-release-hackage

semantic-release plugin to publish a haskell package to Hackage

Motivation

Semantic-release is widely used in the development world but have not been implemented for haskell projects and applications until now. This plugin is intended to help you create your candidate releases for a hackage package using the benefits of semantic-release

Steps

Step Description
verifyConditions verify the environment variable HACKAGE_TOKEN
prepare Update the version of .cabal file and create the distribution package (.tar)
publish Publish the hackage package to the specified repository

Environment variables

Variable Description Required
HACKAGE_TOKEN API token for hackage true

Install

With npm:

npm install semantic-release-hackage -D

With yarn:

yarn add semantic-release-hackage --dev

Usage

The plugin can be configured in the semantic-release configuration file. Here is a minimal example:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "semantic-release-hackage",
      {
        "cabalFile": "yourcabalfilename",
        "packageName": "yourpackagename",
        "versionPrefix": "0.",
        "publishDocumentation": true
      }
    ]
  ]
}

Configuration

packageName

Required: true

Description: Package name in Hackage.

cabalFile

Required: false

Description: Library cabal file name.

Default: The plugin will read your root .cabal file name.

publishDocumentation

Required: false

Description: Boolean value used for publishing release candidate documentation. When true the plugin will publish the documentation along with the candidate release.

Default: false

versionPrefix

Required: false

Description: This is a version prefix created for supporting PVP versioning.

Default: ""

Why adding a versionPrefix configuration?

PVP is the standard versioning system for Haskell projects which is different from Semantic Versioning. You may think that since this is a semantic-release plugin, you'll have to move out from PVP. But thanks to the versionPrefix option, you can keep the 4th digit in your version.

This is just an optional feature to enable backward compatibility when starting to use this plugin.

We strongly recommend moving to semantic versioning to keep things simple and follow a well-known standard. But versionPrefix can save the day if changing the versioning system is not an option.

For example, if you have the version number 0.2.0.7 and want to create a new release for a new feature, semantic-release is going to infer the next version as 2.1.0, you can keep your previous versioning by adding the following to the plugin configuration:

"versionPrefix" : "0."

The plugin will add the 0. prefix to the new version, so your final version will be 0.2.1.0.

License

MIT, see the LICENSE file.

Contributing

Do you want to contribute to this project? Please take a look at our contributing guideline to know how you can help us build it.


Stack Builders
Check out our libraries | Join our team

About

A sematic-release plugin to publish Haskell packages to Hackage

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •