Skip to content

Commit ed5a4cf

Browse files
ci: publish Java SDK release explicitly
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
1 parent 047df04 commit ed5a4cf

4 files changed

Lines changed: 40 additions & 8 deletions

File tree

.woodpecker/release.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,43 @@ steps:
5252
- VERSION="$(printf '%s' "$CI_COMMIT_TAG" | sed 's/^v//')"
5353
- echo "Releasing version $VERSION"
5454
- mvn -B versions:set -DnewVersion="$VERSION" -DprocessAllModules=true -DgenerateBackupPoms=false
55-
- mvn -B -P release clean deploy -DskipTests -Dgpg.keyname="$GPG_KEY_ID" -Dgpg.passphrase="$MAVEN_GPG_PASSPHRASE" -Dgpg.useagent=false
5655
- |
56+
release_log="$(mktemp)"
57+
mvn -B -P release clean deploy -DskipTests -Dgpg.keyname="$GPG_KEY_ID" -Dgpg.passphrase="$MAVEN_GPG_PASSPHRASE" -Dgpg.useagent=false | tee "$release_log"
58+
59+
deployment_id="$(sed -n 's/.*deploymentId: \([0-9a-fA-F-]\{36\}\).*/\1/p' "$release_log" | tail -n 1)"
60+
rm -f "$release_log"
61+
if [ -z "$deployment_id" ]; then
62+
echo "Could not find Sonatype Central deployment id in Maven output"
63+
exit 1
64+
fi
65+
66+
token="$(printf '%s:%s' "$CENTRAL_USERNAME" "$CENTRAL_PASSWORD" | base64 | tr -d '\n')"
67+
status_url="https://central.sonatype.com/api/v1/publisher/status?id=${deployment_id}"
68+
publish_url="https://central.sonatype.com/api/v1/publisher/deployment/${deployment_id}"
5769
artifact_url="https://repo.maven.apache.org/maven2/io/keploy/keploy-sdk/${VERSION}/keploy-sdk-${VERSION}.jar"
58-
echo "Waiting for $artifact_url"
70+
echo "Publishing Sonatype Central deployment $deployment_id"
71+
5972
for attempt in $(seq 1 60); do
73+
status="$(curl -fsS -X POST -H "Authorization: Bearer $token" "$status_url" || true)"
74+
state="$(printf '%s' "$status" | sed -n 's/.*"deploymentState"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')"
75+
76+
case "$state" in
77+
VALIDATED)
78+
curl -fsS -X POST -H "Authorization: Bearer $token" "$publish_url" >/dev/null
79+
;;
80+
PENDING|VALIDATING|PUBLISHING|PUBLISHED)
81+
;;
82+
FAILED)
83+
echo "$status"
84+
exit 1
85+
;;
86+
*)
87+
echo "Unexpected Sonatype Central deployment state: ${state:-unknown}"
88+
echo "$status"
89+
;;
90+
esac
91+
6092
if curl -fsI "$artifact_url" >/dev/null; then
6193
echo "Released artifact is available on Maven Central"
6294
exit 0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Download the `keploy-sdk` jar and keep it outside your application dependencies.
4444
<artifactItem>
4545
<groupId>io.keploy</groupId>
4646
<artifactId>keploy-sdk</artifactId>
47-
<version>2.0.2</version>
47+
<version>2.0.3</version>
4848
<outputDirectory>${project.build.directory}</outputDirectory>
4949
<destFileName>keploy-sdk.jar</destFileName>
5050
</artifactItem>

keploy-sdk/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<parent>
88
<artifactId>java-sdk</artifactId>
99
<groupId>io.keploy</groupId>
10-
<version>2.0.2</version>
10+
<version>2.0.3</version>
1111
</parent>
1212

1313
<artifactId>keploy-sdk</artifactId>
14-
<version>2.0.2</version>
14+
<version>2.0.3</version>
1515
<name>Keploy Java Coverage Agent</name>
1616
<description>Java dynamic dedup coverage agent for Keploy Enterprise</description>
1717
<url>https://github.com/keploy/java-sdk</url>

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.keploy</groupId>
88
<artifactId>java-sdk</artifactId>
9-
<version>2.0.2</version>
9+
<version>2.0.3</version>
1010
<packaging>pom</packaging>
1111

1212
<name>Keploy Java Coverage Agent</name>
@@ -107,8 +107,8 @@
107107
<extensions>true</extensions>
108108
<configuration>
109109
<publishingServerId>central</publishingServerId>
110-
<autoPublish>true</autoPublish>
111-
<waitUntil>published</waitUntil>
110+
<autoPublish>false</autoPublish>
111+
<waitUntil>validated</waitUntil>
112112
</configuration>
113113
</plugin>
114114
</plugins>

0 commit comments

Comments
 (0)