Skip to content

Commit 401686a

Browse files
Show last snapshot update on Workflow (#1406)
* Create a new script to print the last snapshot update * Show last snapshot update after it is published to maven * Revert "Prevent version override (#1396)" This reverts commit 060a74b. * Revert "Add timestamp to all the snapshot versions (#1395)" This reverts commit 1d62a6d. --------- Co-authored-by: Aleksandar Apostolov <[email protected]>
1 parent d9b19a9 commit 401686a

File tree

4 files changed

+49
-10
lines changed

4 files changed

+49
-10
lines changed

.github/workflows/publish-snapshot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
publish:
1111
name: Snapshot build and publish
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-24.04
1313
steps:
1414
- name: Check out code
1515
uses: actions/[email protected]
@@ -33,3 +33,7 @@ jobs:
3333
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
3434
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
3535
SNAPSHOT: true
36+
- name: Show snapshot version
37+
run: ./scripts/show-last-snapshot-update.sh
38+
env:
39+
SNAPSHOT: true

buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ object Configuration {
99
const val patchVersion = 1
1010
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
1111
const val versionCode = 57
12-
const val snapshotBasedVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}"
1312
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
1413
const val artifactGroup = "io.getstream"
1514
const val streamVideoCallGooglePlayVersion = "1.6.0"

scripts/publish-root.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import io.getstream.video.android.Configuration
2-
import java.text.SimpleDateFormat
32

43
// Create variables with empty default values
54
ext["ossrhUsername"] = ''
@@ -27,15 +26,10 @@ if (secretPropsFile.exists()) {
2726
ext["snapshot"] = System.getenv('SNAPSHOT')
2827
}
2928

30-
def timestamp = new SimpleDateFormat('yyyyMMddHHmm').with {
31-
timeZone = TimeZone.getTimeZone('UTC') // keep CI & local builds identical
32-
format(new Date())
33-
}
3429
if (snapshot) {
35-
ext['rootVersionName'] = "${Configuration.snapshotBasedVersionName}-" +
36-
"${timestamp}-SNAPSHOT"
30+
ext["rootVersionName"] = Configuration.snapshotVersionName
3731
} else {
38-
ext['rootVersionName'] = Configuration.versionName
32+
ext["rootVersionName"] = Configuration.versionName
3933
}
4034

4135
// Set up Sonatype repository
@@ -49,3 +43,23 @@ nexusPublishing {
4943
}
5044
}
5145
}
46+
47+
tasks.register("printAllArtifacts") {
48+
group = "publishing"
49+
50+
doLast {
51+
subprojects.each { subproject ->
52+
subproject.plugins.withId("maven-publish") {
53+
def publishingExtension = subproject.extensions.findByType(PublishingExtension)
54+
publishingExtension?.publications?.all { publication ->
55+
if (publication instanceof MavenPublication) {
56+
def groupId = publication.groupId
57+
def artifactId = publication.artifactId
58+
def version = publication.version
59+
println("$groupId:$artifactId:$version")
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Run the Gradle task to get the artifact list and process the output line by line
4+
./gradlew -q printAllArtifacts | while IFS= read -r artifact; do
5+
# Extract groupId, artifactId, and snapshot version from the artifact string
6+
groupId=$(echo $artifact | cut -d: -f1)
7+
artifactId=$(echo $artifact | cut -d: -f2)
8+
snapshotVersion=$(echo $artifact | cut -d: -f3)
9+
10+
# Format the URL for the maven-metadata.xml file in the Nexus repository
11+
url="https://oss.sonatype.org/content/repositories/snapshots/$(echo $groupId | tr '.' '/')/$artifactId/$snapshotVersion/maven-metadata.xml"
12+
13+
# Fetch the maven-metadata.xml using curl and extract the latest release version using sed
14+
latest_version=$(curl -s "$url" | sed -n 's|.*<value>\(.*\)</value>.*|\1|p' | head -n 1)
15+
16+
# Print the result with the latest stable version
17+
if [ -n "$latest_version" ]; then
18+
echo "$groupId:$artifactId:$latest_version"
19+
else
20+
echo "No version found for $artifact"
21+
fi
22+
done

0 commit comments

Comments
 (0)