Skip to content

Conversation

@martinbonnin
Copy link
Member

Closes #21

@martinbonnin martinbonnin merged commit 1cbb8e9 into main May 13, 2025
1 check passed
@martinbonnin martinbonnin deleted the deployment-name branch May 13, 2025 13:44
Comment on lines +13 to +14
./gradlew -p tests/jvm publishAggregationToCentralPortal
./gradlew -p tests/jvm publishAggregationToCentralSnapshots
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a single task that decides on snapshot/release depending on the project version?

E.g. if project.version.toString() ends with -SNAPSHOT, then it should publish to snaphots. Otherwise it should publish to releases.
WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea maybe that'd be better.

But I also kind of like the separation of intents. Having separate task names and separate CI workflows makes for a clear separation. Plus historically those were 2 different task names so there is some brain muscle attached. Not saying we shouldn't change it of course but I'm not 100% convinced it would help yet. Did you have any specific use cases in mind?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reasoning I have in mind is that the action the same: "push publication to the repository".
I don't understand why should I push it differently depending on the project version.
It is pretty much like you don't have jar vs jarSnapshot depending on the project version. You always have a single jar task which builds the jar according to the current project version.

I'm fine if there are two independent technical task for the implementation details, however, in that case it would be nice to have an out of the box wrapper task which would depend on one of them as the project version requires.


Historically, I use "autosnapshot" project version: build script automatically adds -SNAPSHOT to the version unless there's -Prelease flag.

So it sounds reasonable to have ./gradlew publishAllPublicationsToCentralPortal and ./gradlew -Prelease publishAllPublicationsToCentralPortal. In other words: -Prelease selects the project version while the rest ("publish to central portal") being intact.

Copy link
Member Author

@martinbonnin martinbonnin May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the same repository though. The url to consume and the immutability guarantees are not the same.

I get where you're coming from with the -Prelease flag, though. That's interesting and it's currently a pain in my workflows to make a commit specifically to drop the -SNAPSHOT... Having something like this would definitely make it easier.

Give me a few weeks so that I can try it out in a pet project and I'll report back? I'll open an issue so we keep track of this. (edit: here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlsi do you have a sample project using -Prelease I could take inspiration from?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlsi I ended up adopting the "autosnapshot" versioning in a couple of projects, it's nice! Thanks for pointing me to this 🙏

That being, said, I'm not 100% convinced that we need a wrapper task just yet. My snapshot and release workflows are usually different and having different task names doesn't hurt me too much. If anything, they act as an additional explicit check that I'm publishing in the correct location.

I might get there ultimately but since it's always easier to add than remove, I prefer keeping our options open there and not committing in that direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support -SNAPSHOT deployment

3 participants