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
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
build:
timeout-minutes: 15
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/open-transit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

Expand All @@ -61,6 +64,21 @@ jobs:
- name: Build SDK
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/open-transit-java'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload Maven artifacts
if: github.repository == 'stainless-sdks/open-transit-java'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PROJECT: open-transit-java
run: ./scripts/upload-artifacts
test:
timeout-minutes: 15
name: test
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.45"
".": "0.1.0-alpha.46"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.46 (2026-01-13)

Full Changelog: [v0.1.0-alpha.45...v0.1.0-alpha.46](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.45...v0.1.0-alpha.46)

### Chores

* **internal:** support uploading Maven repo artifacts to stainless package server ([4bc9781](https://github.com/OneBusAway/java-sdk/commit/4bc9781829c01677527b5b3dce191908ac6e2a8d))

## 0.1.0-alpha.45 (2026-01-09)

Full Changelog: [v0.1.0-alpha.44...v0.1.0-alpha.45](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.44...v0.1.0-alpha.45)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.45)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.45/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.45)
[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46)

<!-- x-release-please-end -->

Expand All @@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).

<!-- x-release-please-start-version -->

The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.45).
The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46).

<!-- x-release-please-end -->

Expand All @@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://de
### Gradle

```kotlin
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.45")
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.46")
```

### Maven
Expand All @@ -35,7 +35,7 @@ implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.45")
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-sdk-java</artifactId>
<version>0.1.0-alpha.45</version>
<version>0.1.0-alpha.46</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "org.onebusaway"
version = "0.1.0-alpha.45" // x-release-please-version
version = "0.1.0-alpha.46" // x-release-please-version
}

subprojects {
Expand Down
17 changes: 15 additions & 2 deletions buildSrc/src/main/kotlin/onebusaway-sdk.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ plugins {
id("com.vanniktech.maven.publish")
}

publishing {
repositories {
if (project.hasProperty("publishLocal")) {
maven {
name = "LocalFileSystem"
url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo")
}
}
}
}

repositories {
gradlePluginPortal()
mavenCentral()
Expand All @@ -17,8 +28,10 @@ extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID")
extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD")

configure<MavenPublishBaseExtension> {
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
if (!project.hasProperty("publishLocal")) {
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
}

coordinates(project.group.toString(), project.name, project.version.toString())
configure(
Expand Down
96 changes: 96 additions & 0 deletions scripts/upload-artifacts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env bash

set -euo pipefail

# ANSI Color Codes
GREEN='\033[32m'
RED='\033[31m'
NC='\033[0m' # No Color

log_error() {
local msg="$1"
local headers="$2"
local body="$3"
echo -e "${RED}${msg}${NC}"
[[ -f "$headers" ]] && echo -e "${RED}Headers:$(cat "$headers")${NC}"
echo -e "${RED}Body: ${body}${NC}"
exit 1
}

upload_file() {
local file_name="$1"
local tmp_headers
tmp_headers=$(mktemp)

if [ -f "$file_name" ]; then
echo -e "${GREEN}Processing file: $file_name${NC}"
pkg_file_name="mvn${file_name#./build/local-maven-repo}"

# Get signed URL for uploading artifact file
signed_url_response=$(curl -X POST -G "$URL" \
-sS --retry 5 \
-D "$tmp_headers" \
--data-urlencode "filename=$pkg_file_name" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

# Validate JSON and extract URL
if ! signed_url=$(echo "$signed_url_response" | jq -e -r '.url' 2>/dev/null) || [[ "$signed_url" == "null" ]]; then
log_error "Failed to get valid signed URL" "$tmp_headers" "$signed_url_response"
fi

# Set content-type based on file extension
local extension="${file_name##*.}"
local content_type
case "$extension" in
jar) content_type="application/java-archive" ;;
md5|sha1|sha256|sha512) content_type="text/plain" ;;
module) content_type="application/json" ;;
pom|xml) content_type="application/xml" ;;
*) content_type="application/octet-stream" ;;
esac

# Upload file
upload_response=$(curl -v -X PUT \
--retry 5 \
-D "$tmp_headers" \
-H "Content-Type: $content_type" \
--data-binary "@${file_name}" "$signed_url" 2>&1)

if ! echo "$upload_response" | grep -q "HTTP/[0-9.]* 200"; then
log_error "Failed upload artifact file" "$tmp_headers" "$upload_response"
fi

# Insert small throttle to reduce rate limiting risk
sleep 0.1
fi
}

walk_tree() {
local current_dir="$1"

for entry in "$current_dir"/*; do
# Check that entry is valid
[ -e "$entry" ] || [ -h "$entry" ] || continue

if [ -d "$entry" ]; then
walk_tree "$entry"
else
upload_file "$entry"
fi
done
}

cd "$(dirname "$0")/.."

echo "::group::Creating local Maven content"
./gradlew publishMavenPublicationToLocalFileSystemRepository -PpublishLocal
echo "::endgroup::"

echo "::group::Uploading to pkg.stainless.com"
walk_tree "./build/local-maven-repo"
echo "::endgroup::"

echo "::group::Generating instructions"
echo "Configure maven or gradle to use the repo located at 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'"
echo "::endgroup::"
Loading