Skip to content

Commit

Permalink
chore: Use the .env file to manage the version number
Browse files Browse the repository at this point in the history
Now that we have the `docker-compose.yaml` files reading from a `.env` file, we can use the same file to configure Gradle. This provides a single point to configure the version for the whole project.
  • Loading branch information
Carlos Tasada committed Jul 12, 2023
1 parent c8b6876 commit d83fb9b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
22 changes: 10 additions & 12 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@

The following lists describe the steps necessary to release a new version.

1. Update the version number in `.env`

## SpringWolf

1. Update version number in `build.gradle`
2. Run all tests (including all examples + integration)
3. Run github `Publish releases` pipeline
4. Release version in nexus
5. Update version number on website
1. Run all tests (including all examples + integration)
2. Run github `Publish releases` pipeline
3. Release version in nexus
4. Update version number on website

## springwolf-ui

1. Update version number in `build.gradle`
2. Update version number in `README.md`
3. Run github `Publish releases` pipeline
4. Release version in nexus
5. Update version number on website
1. Update version number in `README.md`
2. Run github `Publish releases` pipeline
3. Release version in nexus
4. Update version number on website

## Plugins

1. Update version number in `.env`

### springwolf-amqp

1. Update version number in
Expand Down
23 changes: 21 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ plugins {
id("org.owasp.dependencycheck") version "8.3.1"
}

getenv().each { key, value -> if (System.getProperty(key as String) == null) { System.setProperty(key as String, value as String) } }

allprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
Expand All @@ -22,7 +24,7 @@ allprojects {
isSnapshot = Boolean.valueOf(project.findProperty('SNAPSHOT') as String)
}
group 'io.github.springwolf'
version '0.13.0' + (isSnapshot ? '-SNAPSHOT' : '')
version System.getProperty("SPRINGWOLF_VERSION") + (isSnapshot ? '-SNAPSHOT' : '')

java {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down Expand Up @@ -118,4 +120,21 @@ allprojects {
dependencyCheck {
outputDirectory = "$buildDir/reports/owasp-dependency-check"
formats = [ReportGenerator.Format.SARIF.toString()]
}
}

def static getenv(path = ".env") {
def env = [:]

def file = new File(path)
if (file.exists()) {
file.eachLine { line ->
line = line.trim()
if (line != "" && !line.startsWith("#")) {
def pair = line.split("=", 2)
env[pair[0].trim()] = pair.length == 2 ? pair[1].trim() : ""
}
}
}

return env
}

0 comments on commit d83fb9b

Please sign in to comment.