diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2d60258812..c74fcf9d2c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,7 @@ on: env: REGISTRY: ghcr.io + IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} jobs: publish: @@ -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. diff --git a/build.gradle b/build.gradle index a2093ae853..f218222dac 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/gradle.properties b/gradle.properties index 922262763f..0e7e87225a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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