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
8 changes: 4 additions & 4 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
with:
java-version: '11'
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
cache-disabled: true
# TODO(jradcliff): Add a lint step. Currently blocked by https://github.com/abcxyz/actions/issues/107.
Expand Down
12 changes: 12 additions & 0 deletions .kokoro/release.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Format: //devtools/kokoro/config/proto/build.proto

build_file: "github/data-manager-java/.kokoro/release.sh"

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 74347
keyname: "google_ads_java_gpg_secring"
}
}
}
63 changes: 63 additions & 0 deletions .kokoro/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -euo pipefail
set -x

REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${REPO_DIR}"

# Ensure Java 17 is used on Kokoro Ubuntu 22.04 workers (which default to OpenJDK 11)
if [[ ! -d "/usr/lib/jvm/java-17-openjdk-amd64" ]]; then
echo "ERROR: Kokoro worker missing expected OpenJDK 17 at /usr/lib/jvm/java-17-openjdk-amd64" >&2
exit 1
fi
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
export PATH="${JAVA_HOME}/bin:${PATH}"

# 1. Clean, Test, Sign, and Publish to Artifact Registry
# Keyring / ADC handles authentication via the Kokoro BYOSA service account
# Keystore fetches the PGP signing key from Keystore config 74347
KEYSTORE_GPG_FILE="${KOKORO_KEYSTORE_DIR:-}/74347_google_ads_java_gpg_secring"
if [[ -n "${KOKORO_KEYSTORE_DIR:-}" && -f "${KEYSTORE_GPG_FILE}" ]]; then
export SIGNING_KEY="$(cat "${KEYSTORE_GPG_FILE}")"
fi

if [[ -z "${SIGNING_KEY:-}" ]]; then
echo "ERROR: SIGNING_KEY is not set and Keystore GPG file is missing (${KEYSTORE_GPG_FILE})." >&2
exit 1
fi

./gradlew clean check publish --no-daemon

# 2. DRY_RUN Check
if [[ "${DRY_RUN:-false}" == "true" ]]; then
echo "=== DRY_RUN is enabled. Artifacts staged in Artifact Registry. ==="
echo "Skipping GCS manifest upload to Exit Gate."
exit 0
fi

# 3. Create Exit Gate Release Manifest
# Maven Central manifests require 'namespace' (groupId) and package 'name' (artifactId)
cat <<EOF > manifest.json
{
"publish_all": false,
"publishing_groups": [
{
"namespace": "com.google.api-ads",
"packages": [
{
"name": "data-manager-util"
}
]
}
]
}
EOF

# 4. Trigger Exit Gate Release via GCS Manifest
EXIT_GATE_BUCKET="gs://oss-exit-gate-prod-projects-bucket/measurement-devrel/mavencentral/manifests"
MANIFEST_NAME="manifest-$(date +%Y%m%d%H%M%S).json"

echo "=== Uploading manifest to ${EXIT_GATE_BUCKET}/${MANIFEST_NAME} ==="
gcloud storage cp manifest.json "${EXIT_GATE_BUCKET}/${MANIFEST_NAME}"

echo "=== Release successfully triggered to OSS Exit Gate! ==="
6 changes: 4 additions & 2 deletions data-manager-samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ plugins {
id 'java-library'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
// Use Maven Central for resolving dependencies.
Expand Down
72 changes: 68 additions & 4 deletions data-manager-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,81 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.google.cloud.artifactregistry.gradle-plugin' version '2.2.5' apply false
}

def isPublishing = gradle.startParameter.taskNames.any { it.endsWith('publish') || it.contains('ArtifactRegistry') }
if (isPublishing) {
apply plugin: 'com.google.cloud.artifactregistry.gradle-plugin'
}

group = 'com.google.api-ads'
description = 'Utilities for working with the Data Manager API'
version = '0.4.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}

publishing {
publications {
library(MavenPublication) {
from components.java
pom {
name = 'Google Data Manager API Utilities'
description = 'Utilities for working with the Data Manager API'
url = 'https://github.com/googleads/data-manager-java'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'josh'
name = 'Josh Radcliff'
email = 'jradcliff@users.noreply.github.com'
organization = 'Google'
organizationUrl = 'https://www.google.com'
}
developer {
id = 'lindsey'
name = 'Lindsey Volta'
email = 'lindsey-volta@users.noreply.github.com'
organization = 'Google'
organizationUrl = 'https://www.google.com'
}
}
scm {
connection = 'scm:git:git://github.com/googleads/data-manager-java.git'
developerConnection = 'scm:git:ssh://github.com:googleads/data-manager-java.git'
url = 'https://github.com/googleads/data-manager-java'
}
}
}
}
repositories {
if (isPublishing) {
maven {
name = 'ExitGateArtifactRegistry'
url = uri(findProperty('artifact-registry-url') ?: "artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/measurement-devrel--mavencentral")
}
}
}
}

publishing.publications {
library(MavenPublication).from components.java
signing {
def signingKey = findProperty("signingKey") ?: System.getenv("SIGNING_KEY")
def signingPassword = findProperty("signingPassword") ?: System.getenv("SIGNING_PASSWORD")
if (signingKey) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.library
}
}

// Creates install "alias".
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
33 changes: 20 additions & 13 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading