From 59a50a6498061c40269dc185b1a83ca5b44cddd7 Mon Sep 17 00:00:00 2001 From: Mas Azalya Date: Fri, 16 Oct 2026 12:14:53 +0800 Subject: [PATCH] DEV-1115 Refuse a 'local' publish and time out a hung build Re-enabling the publishing block means a hand-run `gradlew publish` without -PreleaseVersion would push version 'local' to GitHub Packages, where it can never be overwritten; developers already keep gpr.key in GRADLE_USER_HOME for reading the driver. Publishing to a remote repository now refuses 'local'; publishToMavenLocal is unaffected. Add job timeouts so a hung Gradle daemon cannot hold a runner for the default 6 hours (as happened to the CI run on #124). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 2 ++ .../ShimmerAndroidInstrumentDriver/build.gradle | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b77504a2..372781b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,6 +61,7 @@ defaults: 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 @@ -206,6 +207,7 @@ jobs: needs: build 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: diff --git a/ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver/build.gradle b/ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver/build.gradle index eb8f8dbd..5aa01b7e 100644 --- a/ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver/build.gradle +++ b/ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver/build.gradle @@ -104,6 +104,16 @@ publishing { } } } +// Without -PreleaseVersion the version is 'local', and GitHub Packages never lets a version be +// overwritten. Releases go through the Release Android 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 Android API workflow, or pass -PreleaseVersion.") + } + } +} dependencies { implementation 'com.google.guava:guava:20.0' implementation 'java3d:vecmath:1.3.1'