go-semantic-release / semantic-release

📦🚀 semantic-release written in Go
https://go-semantic-release.xyz
MIT License
395 stars 43 forks source link

maintainedVersion does not create a pre-release #144

Open Silthus opened 2 years ago

Silthus commented 2 years ago

Hi,

I have a .semrelrc file with the following content to create pre-releases for beta versions:

{
  "maintainedVersion": "2-beta"
}

The beta release is created just fine, however I expected it to be a pre-release (in Github) which it is not. How can I make beta releases pre-releases, but not the releases on main?

christophwitzko commented 2 years ago

Hey @Silthus, this is correct. The pre-release flag is always disabled by default.

You can either use the CLI flag --prerelease to enable pre-releases or you can add a provider config to you .semrelrc:

{
  "maintainedVersion": "2-beta",
  "plugins": {
    "provider": {
      "name": "github",
      "options": {
        "prerelease": true
      }
    }
  }
}
Silthus commented 2 years ago

Hey @Silthus, this is correct. The pre-release flag is always disabled by default.

You can either use the CLI flag --prerelease to enable pre-releases or you can add a provider config to you .semrelrc:

{
  "maintainedVersion": "2-beta",
  "plugins": {
    "provider": {
      "name": "github",
      "options": {
        "prerelease": true
      }
    }
  }
}

Thank you for the quick answer. However one question remains: will this also affect the stable releases on the main branch? I only want to release pre-preleases on the beta branch.

christophwitzko commented 2 years ago

If the .semrelrc only exists on the beta branch then it should work as expected.

Silthus commented 2 years ago

But wouldn't it be better to have a branch specific configuration? Because this way I would need to delete or modify the config before a release merge into the mainline and always need to keep them diverged.

The node version of semantic-release does it like this:

.releaserc

{
  "branches": [
    "main", 
    {"name": "next", "prerelease": true }
]}

So maybe something like this? (just trying to think here if this would be a feature that makes sense):

{
  "maintainedVersion": "2-beta",
  "versionPlugins": {
    "2-beta": {
       "provider": {
        "name": "github",
        "options": {
          "prerelease": true // override global configuration per maintained version?
        }
    }
  }
  "plugins": {
    "provider": {
      "name": "github",
      "options": {
        "prerelease": false
      }
    }
  }
}