diff --git a/.github/workflows/publish_main_snapshot.yml b/.github/workflows/publish_main_snapshot.yml index 1be3a18..7584d04 100644 --- a/.github/workflows/publish_main_snapshot.yml +++ b/.github/workflows/publish_main_snapshot.yml @@ -20,4 +20,4 @@ jobs: ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} - run: ./gradlew build publish \ No newline at end of file + run: ./gradlew build publish diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 0000000..a8d9cb7 --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,24 @@ +name: publish release version explicitly + +on: + release: + types: + - published + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1.3.0 + with: + java-version: 11 + - name: Build with Gradle + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} + run: ./gradlew build publish -Prelease=true \ No newline at end of file diff --git a/build.gradle b/build.gradle index 460f260..1a66a85 100644 --- a/build.gradle +++ b/build.gradle @@ -48,6 +48,15 @@ dependencies { testImplementation 'io.opentracing:opentracing-mock:0.33.0' } +// -Prelease=true will render a non-snapshot version +// All other values (including unset) will render a snapshot version. +def release = findProperty("release") +version = project.findProperty("version") + +if (!release) { + version += "-SNAPSHOT" +} + jar { from(projectDir) { include "README.md" } diff --git a/gradle.properties b/gradle.properties index 1213f5b..4044cd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ group = com.newrelic.opentracing -version = 2.1.0-SNAPSHOT +version = 2.1.0