Skip to content

Commit

Permalink
Simplify + fix gradle commands
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan authored Sep 11, 2024
1 parent 1183651 commit a118e30
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 72 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: build
run: |
./gradlew build
- uses: actions/upload-artifact@v4
with:
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/build_jar.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/gradle.yml

This file was deleted.

15 changes: 8 additions & 7 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Add release flag if input variable is set
if: ${{ inputs.release }}
shell: bash
run: |
echo "RELEASE_FLAG='-P release=true'" >> $GITHUB_ENV
echo "RELEASE_FLAG='-Prelease'" >> $GITHUB_ENV
- name: Publish snapshot
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publish -P toolchain=21 $RELEASE_FLAG
- name: Publish
shell: bash
run: |
./gradlew publish -P toolchain=21 $RELEASE_FLAG
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}

- uses: actions/upload-artifact@v3
if: ${{ inputs.release }}
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/maven_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ jobs:
build:
name: Publish release
uses: ./.github/workflows/maven.yml
secrets: inherit
with:
release: true
1 change: 1 addition & 0 deletions .github/workflows/maven_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ jobs:
build:
name: Publish snapshot
uses: ./.github/workflows/maven.yml
secrets: inherit
35 changes: 34 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
// Main gradle plugin for building a Java library
id 'java-library'
id 'maven-publish'
// To create a shadow/fat jar that bundle up all dependencies
id 'com.github.johnrengelman.shadow' version '8.1.1'
// Add JavaFX dependencies
Expand All @@ -12,6 +13,7 @@ plugins {
ext.moduleName = 'qupath.extension.omero'
version = "0.1.1-rc1"
description = "QuPath extension to support image reading using OMERO APIs."
group = 'io.github.qupath'
ext.qupathVersion = gradle.ext.qupathVersion
ext.qupathJavaVersion = libs.versions.jdk.get()

Expand Down Expand Up @@ -117,4 +119,35 @@ repositories {
name "unidata.releases<"
url "https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases"
}
}
}

publishing {
repositories {
maven {
name = "SciJava"
def releasesRepoUrl = uri("https://maven.scijava.org/content/repositories/releases")
def snapshotsRepoUrl = uri("https://maven.scijava.org/content/repositories/snapshots")
// Use gradle -Prelease publish
url = project.hasProperty('release') ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
}
}
}

publications {
mavenJava(MavenPublication) {
from components.java

pom {
licenses {
license {
name = 'Apache License v2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0'
}
}
}
}
}
}

0 comments on commit a118e30

Please sign in to comment.