Skip to content

Commit

Permalink
Merge pull request #84 from NASA-AMMOS/feature/release-boolean-gradle…
Browse files Browse the repository at this point in the history
…-property

Feature/Parameterize versioning for releases and snapshots
  • Loading branch information
JoelCourtney authored Mar 5, 2022
2 parents 5979fd3 + ef14ee4 commit bcb2bae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
REGISTRY: ghcr.io
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}

jobs:
publish:
Expand Down Expand Up @@ -85,7 +86,7 @@ jobs:
labels: ${{ steps.aerieCommanding.outputs.labels }}
# Publish via Gradle.
- name: Publish Package
run: ./gradlew publish
run: ./gradlew publish -Pversion.isRelease=$IS_RELEASE
env:
GITHUB_TOKEN: ${{ github.token }}
# Publish deployment via action artifact uploader.
Expand Down
11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ subprojects {
}

group = 'gov.nasa.jpl.aerie'
def hash = 'git rev-parse --short HEAD'.execute().text.trim()
version = "0.10.0-SNAPSHOT-$hash"

version = {
if (findProperty("version.isRelease").toBoolean()) {
return "${findProperty("version.number")}"
} else {
def hash = 'git rev-parse --short HEAD'.execute().text.trim()
return "${findProperty("version.number")}-SNAPSHOT-$hash"
}
}()

tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
Expand Down
8 changes: 8 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ publishing.name=GitHubPackages
publishing.url=https://maven.pkg.github.com/nasa-ammos/aerie
publishing.usernameEnvironmentVariable=GITHUB_ACTOR
publishing.passwordEnvironmentVariable=GITHUB_TOKEN

# Override for releases

# Change the version number here
version.number=0.10.1
# If you are publishing a release *manually* (i.e. not through github actions),
# override this on the command line with `./gradlew publish -Pversion.isRelease=true`.
version.isRelease=false // override this on the command line

0 comments on commit bcb2bae

Please sign in to comment.