Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increment version prior to publishing in GitHub packages

Tags:

java

gradle

How to increment version prior to publishing in GitHub packages. We update version attribute everytime before we do ./gradlew publish

Snippet from build.gradle

group = 'com.company.user'
version = '0.0.1'
description = """user-service"""

If we build and publish using GitHub action, how do I auto increment version prior to running the publish command

like image 236
user352290 Avatar asked Feb 01 '26 07:02

user352290


1 Answers

I used the Gradle Release Plugin (https://github.com/researchgate/gradle-release) successfully.

It checks for SNAPSHOT-Dependencies before the release and also has a built in autoVersioning (look for the Working in Continuous Integration in the docs). If you need, you can specify the versions manually, but you don't have to.

This is not specially made for GitHub actions, but from my experience with such vendor-bindings for projects where you plan long-term development or support I would not work with special plugins there - it will make a potential migration to another system harder.

like image 173
cyberbrain Avatar answered Feb 03 '26 20:02

cyberbrain