Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .github/workflows/snapshot-kmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- develop
paths:
- "meshtastic/**/*.proto"
- "nanopb.proto"
Expand All @@ -18,17 +19,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Compute snapshot version
id: version
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
RELEASE_VERSION="${TAG#v}"
IFS='.' read -r major minor patch <<< "$RELEASE_VERSION"
SNAPSHOT_VERSION="${major}.${minor}.$((patch + 1))-SNAPSHOT"
echo "snapshot=$SNAPSHOT_VERSION" >> "$GITHUB_OUTPUT"

- name: Setup Java
uses: actions/setup-java@v4
Expand All @@ -43,7 +33,7 @@ jobs:
uses: gradle/actions/setup-gradle@v4

- name: Build KMP package
run: packages/kmp/gradlew --no-daemon -p packages/kmp build -PVERSION_NAME=${{ steps.version.outputs.snapshot }}
run: packages/kmp/gradlew --no-daemon -p packages/kmp build -PVERSION_NAME=${{ github.ref_name }}-SNAPSHOT

- name: Publish snapshot to Maven Central
env:
Expand All @@ -56,4 +46,4 @@ jobs:
echo "Missing Maven Central secrets — skipping snapshot publish." >&2
exit 0
fi
packages/kmp/gradlew --no-daemon -p packages/kmp publishAllPublicationsToMavenCentralRepository -PVERSION_NAME=${{ steps.version.outputs.snapshot }}
packages/kmp/gradlew --no-daemon -p packages/kmp publishAllPublicationsToMavenCentralRepository -PVERSION_NAME=${{ github.ref_name }}-SNAPSHOT
22 changes: 17 additions & 5 deletions packages/kmp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ The SDK version is derived automatically from the latest git tag — no manual v
| Context | Version | Source |
|---------|---------|--------|
| Release CI (`v2.7.23` tag push) | `2.7.23` | Tag stripped of `v` prefix, passed as `-PVERSION_NAME` |
| Snapshot CI (master push) | `2.7.24-SNAPSHOT` | Latest tag + patch bump, computed in workflow |
| Snapshot CI (`master` push) | `master-SNAPSHOT` | Branch name, passed as `-PVERSION_NAME` |
| Snapshot CI (`develop` push) | `develop-SNAPSHOT` | Branch name, passed as `-PVERSION_NAME` |
| Local dev (no flag) | `2.7.24-SNAPSHOT` | `git describe --tags --abbrev=0` + patch bump |
| Local override | any | `./gradlew build -PVERSION_NAME=x.y.z` |

Expand Down Expand Up @@ -51,9 +52,11 @@ implementation("org.meshtastic:protobufs:2.7.23")

### Snapshots

Snapshot builds (published from `master`) live in the Central Portal snapshots
repository, not on the main Maven Central CDN. To consume them, add that
repository alongside `mavenCentral()` and depend on a `-SNAPSHOT` version:
Snapshot builds are published from `master` and `develop` under the stable
coordinates `master-SNAPSHOT` and `develop-SNAPSHOT` — pin once and every push
to that branch republishes the same version. They live in the Central Portal
snapshots repository, not on the main Maven Central CDN. To consume them, add
that repository alongside `mavenCentral()`:

```kotlin
// settings.gradle.kts (or build.gradle.kts)
Expand All @@ -65,7 +68,16 @@ repositories {
}

// build.gradle.kts
implementation("org.meshtastic:protobufs:2.7.24-SNAPSHOT")
implementation("org.meshtastic:protobufs:develop-SNAPSHOT")
```

Gradle caches snapshot resolutions for 24 hours by default. To always pick up
the latest publish during active development:

```kotlin
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "minutes")
}
```

## Local build
Expand Down
Loading