2.2.0 — Maven Central + tech.thessemaj #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Publishes the runtime AAR + Gradle plugin + marker POM to Maven Central | |
| # (Sonatype Central Portal) under tech.thessemaj when you publish a GitHub | |
| # Release. Signed with the shared GPG key. | |
| # | |
| # Consumers then need no custom repository — plain mavenCentral() resolves both | |
| # implementation("tech.thessemaj:deviceintelligence:<version>") | |
| # id("tech.thessemaj.deviceintelligence") version "<version>" | |
| name: Publish to Maven Central | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version to publish (e.g. 2.2.0) | |
| required: true | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: maven-central-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| # gradle.properties VERSION_NAME is this repo's single source of truth | |
| # (both modules read it; the plugin bakes it into PluginCoordinates so the | |
| # auto-applied runtime AAR never skews). Enforce that the release tag | |
| # matches it, rather than trying to override at publish time. | |
| - name: Verify tag matches gradle.properties | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| TAG="${{ github.event.release.tag_name }}" | |
| else | |
| TAG="${{ inputs.version }}" | |
| fi | |
| TAG="${TAG#v}" | |
| PROP="$(grep -E '^VERSION_NAME=' gradle.properties | cut -d= -f2)" | |
| if [ "$TAG" != "$PROP" ]; then | |
| echo "::error::Release tag '$TAG' != gradle.properties VERSION_NAME '$PROP'. Bump gradle.properties and re-tag." | |
| exit 1 | |
| fi | |
| echo "Publishing version $PROP" | |
| - name: Install Android SDK (matches AGP / CMake / NDK in module build.gradle.kts) | |
| shell: bash | |
| run: | | |
| set -eu | |
| export ANDROID_SDK_ROOT="$HOME/android-sdk" | |
| export ANDROID_HOME="$ANDROID_SDK_ROOT" | |
| mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" | |
| curl -sSLo /tmp/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip | |
| unzip -qo /tmp/cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" | |
| mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" | |
| export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH" | |
| mkdir -p "$ANDROID_SDK_ROOT/licenses" | |
| printf '\n24333f8a63b6825ea9c5514f748d145ef07021\n' > "$ANDROID_SDK_ROOT/licenses/android-sdk-license" | |
| printf '\n84831b9409646a918e30573bab4c9c91346d8abd\n' > "$ANDROID_SDK_ROOT/licenses/android-sdk-preview-license" | |
| yes | sdkmanager --sdk_root="$ANDROID_SDK_ROOT" --licenses | |
| sdkmanager --sdk_root="$ANDROID_SDK_ROOT" --install \ | |
| "platform-tools" "platforms;android-36" "build-tools;36.0.0" \ | |
| "ndk;27.0.12077973" "cmake;3.22.1" | |
| { | |
| echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" | |
| echo "ANDROID_HOME=$ANDROID_SDK_ROOT" | |
| echo "PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH" | |
| } >> "$GITHUB_ENV" | |
| - name: Publish runtime AAR to Maven Central | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew :deviceintelligence:publishAndReleaseToMavenCentral --no-daemon -x test --stacktrace | |
| - name: Publish Gradle plugin (+ marker) to Maven Central | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} | |
| run: | | |
| ./gradlew -p deviceintelligence-gradle publishAndReleaseToMavenCentral --no-daemon --stacktrace |