allegro / allegro/axion-release-plugin

Correct way to configure a release channel (not based on branch)

Open
#434 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
641
Forks
165
Avg merge
49m
Merged PRs (30d)
9

Description

I'd like to publish released versions of a software per channel. Where the channel is appended to the version number, this is important as the distribution mechanism rely on the suffix to route the release.

I recognize this is similar to _release marker_ like beta, rc, but not quite the same as the marker here will serve as routing in the distribution channel on which I don't have control.

E.g here's what the release would look like on a channel `eap`,

* v0.1.0-eap
* v0.1.1-eap
* v0.1.2-eap
* v0.2.0-eap

But at the same time I'd like to publish some of these version in a different channel.

* v0.1.0-beta
* v0.2.0-beta

The channel can be configured via a property so I'd like to make releases in a row on x channels

```shell
$ ./gradlew release -Pchannel=eap
$ ./gradlew release -Pchannel=beta
```

That would produce multiple tag on a single commit.

```shell
$ git log --no-walk --tags
commit 60e939a66ab445729ef94808b912ac6670d320a1 (HEAD -> master, tag: v0.2.3-eap, tag: v0.2.3-beta, origin/master, origin/HEAD)
...
```

Unfortunately the second release command bails out as the current commit is already tagged, this can be overridden by `Prelease.forceSnapshot` but then it increments the version. I think setting a no-op `versionIncrementer` could help, but only for the second release command, and I'm unsure about that.

Here's what I came up until now, and wondered if someone could second guess or suggest better alternatives.

```kotlin
val channel = properties("pluginVersionChannel")

scmVersion {
// nextVersion(closureOf {
// suffix = channel
// separator = "-"
// })

tag(closureOf {
serialize = KotlinClosure2(
function = { _, version ->
"v${version}-${channel}"
},
owner = this,
thisObject = this
)
})

snapshotCreator = KotlinClosure2(
function = { _, position ->
"-${position.shortRevision}"
},
owner = this,
thisObject = this
)

checks(closureOf { isUncommittedChanges = false })
}

version = scmVersion.version

```

There are other approach to having multiple command, I think the less error error prone would be to pass channels as a list. Something like :

```
$ ./gradlew release -Pchannel=beta,eap
```

And this command will write the two tags on the current commit.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.