Versioning via Git Tag in Jetbrains Space Automation

188 views Asked by At

I am currently trying to solve a versioning problem in my application: I want to use the git tag as a version number inside a JetBrains Space automation script.

My .space.kts is based on a template from the official docs and contains the following relevant job:

job("Deploy") {
    container("Run deploy script", image = "gradle:7.1-jre11") {
        kotlinScript { api ->
            // ...

            api.space().projects.automation.deployments.schedule(
                project = api.projectIdentifier(),
                targetIdentifier = TargetIdentifier.Key("production-server"),
                version = "1.0.0" // Here, I need the git tag
            )
        }
    }
}

I have not been able to find a good solution. And I am wondering why that is:

  • Did I not manage to research correctly?
  • Is my approach not sensible?
  • If so, what would be considered best-practices for setting a version? Are there resources I can use to learn?

Most example I saw, used the build execution number or some other env variable to compose a version number. But I cannot really make sense of that approach, since I want to adhere to semver, have git tags to organize VCS and automate this process.

Thanks for your help in clarifying the issue.

0

There are 0 answers