diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a34d69d8a..903707753 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,6 +56,7 @@ concurrency: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 30 # a hung Gradle daemon otherwise holds the runner for 6 hours permissions: contents: read packages: write @@ -166,6 +167,7 @@ jobs: matlab-jar: needs: build runs-on: ubuntu-latest + timeout-minutes: 30 # a hung Gradle daemon otherwise holds the runner for 6 hours permissions: contents: read steps: @@ -211,6 +213,7 @@ jobs: needs: [build, matlab-jar] if: github.event_name == 'workflow_dispatch' && !inputs.dry_run runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write # create the tag and the release env: @@ -248,6 +251,7 @@ jobs: update-matlab: needs: [build, release] runs-on: ubuntu-latest + timeout-minutes: 10 permissions: {} # writes to Shimmer-MATLAB-ID with MATLAB_REPO_TOKEN, not this repo's token env: VERSION: ${{ needs.build.outputs.version }} diff --git a/ShimmerBluetoothManager/build.gradle b/ShimmerBluetoothManager/build.gradle index c4961ecda..6bf3cb637 100644 --- a/ShimmerBluetoothManager/build.gradle +++ b/ShimmerBluetoothManager/build.gradle @@ -68,3 +68,14 @@ dependencies { // 'test.useTestNG()' to your build script. testImplementation 'junit:junit:4.12' } + +// Without -PreleaseVersion the version is 'local', and GitHub Packages never lets a version be +// overwritten. Releases go through the Release Java API workflow; publishToMavenLocal is unaffected. +tasks.withType(PublishToMavenRepository).configureEach { + doFirst { + if (publication.version == 'local') { + throw new GradleException("Refusing to publish ${publication.artifactId} as version 'local'. " + + "Release with the Release Java API workflow, or pass -PreleaseVersion.") + } + } +} diff --git a/ShimmerDriver/build.gradle b/ShimmerDriver/build.gradle index 84d17c6ea..8d62a7215 100644 --- a/ShimmerDriver/build.gradle +++ b/ShimmerDriver/build.gradle @@ -173,3 +173,14 @@ tasks.withType(Test).configureEach { } } + +// Without -PreleaseVersion the version is 'local', and GitHub Packages never lets a version be +// overwritten. Releases go through the Release Java API workflow; publishToMavenLocal is unaffected. +tasks.withType(PublishToMavenRepository).configureEach { + doFirst { + if (publication.version == 'local') { + throw new GradleException("Refusing to publish ${publication.artifactId} as version 'local'. " + + "Release with the Release Java API workflow, or pass -PreleaseVersion.") + } + } +} diff --git a/ShimmerDriverPC/build.gradle b/ShimmerDriverPC/build.gradle index 3b4ad7258..623db5df3 100644 --- a/ShimmerDriverPC/build.gradle +++ b/ShimmerDriverPC/build.gradle @@ -41,6 +41,11 @@ publishing { publications { mavenJava(MavenPublication) { from components.java + // The Shadow plugin adds ShimmerJavaClass.jar (no classifier) to components.java, where it + // collides with the plain jar and fails publish on Gradle 8. Publish the plain jar with its + // dependencies in the POM, as releases up to 0.11.7_beta did; the fat jar goes to MATLAB + // and the GitHub Release instead. + components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } groupId = 'com.shimmerresearch' // Replace with your package's group/organization name artifactId = 'shimmerdriverpc' // Replace with the name of your package @@ -132,3 +137,14 @@ shadowJar { mergeServiceFiles() // Merges service files (if any) } + +// Without -PreleaseVersion the version is 'local', and GitHub Packages never lets a version be +// overwritten. Releases go through the Release Java API workflow; publishToMavenLocal is unaffected. +tasks.withType(PublishToMavenRepository).configureEach { + doFirst { + if (publication.version == 'local') { + throw new GradleException("Refusing to publish ${publication.artifactId} as version 'local'. " + + "Release with the Release Java API workflow, or pass -PreleaseVersion.") + } + } +}