Skip to content

Commit 23dc607

Browse files
authored
Change publish maven repo to s3 bucket (#31)
* Change publish maven repo to s3 bucket * Remove mavenLocal from plugin repos, and set as last for dependency repos * bump version * bump to 1.2.1-dr-9 * Change groupd id * Add publish script * rename publish script * Add -x test to gradle publish
1 parent a3c9fcd commit 23dc607

File tree

6 files changed

+70
-6
lines changed

6 files changed

+70
-6
lines changed

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ allprojects {
3232
includeGroup "com.github.philburk"
3333
}
3434
}
35+
mavenLocal()
3536
}
37+
3638
if (it.hasProperty('externalBuildDir')) {
3739
if (!new File(externalBuildDir).isAbsolute()) {
3840
externalBuildDir = new File(rootDir, externalBuildDir)
3941
}
4042
buildDir = "${externalBuildDir}/${project.name}"
4143
}
42-
group = 'androidx.media3'
44+
group = 'com.endeavorstreaming.androidx-media'
4345
}

common_library_config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
apply from: "$gradle.ext.androidxMediaSettingsDir/constants.gradle"
1515
apply plugin: 'com.android.library'
1616

17-
group='com.github.DiceTechnology'
17+
group='com.endeavorstreaming.androidx-media'
1818

1919
android {
2020
compileSdkVersion project.ext.compileSdkVersion

constants.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
project.ext {
15-
releaseVersion = '1.2.1'
15+
releaseVersion = '1.2.1-dr9'
1616
releaseVersionCode = 1_002_001_3_00
1717
minSdkVersion = 16
1818
// See https://developer.android.com/training/cars/media/automotive-os#automotive-module

missing_aar_type_workaround.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def addMissingAarTypeToXml(xml) {
7575
.children()[0]
7676
String dependencyName = groupId + ":" + artifactId
7777
boolean isProjectLibrary =
78-
groupId == 'androidx.media3'
78+
groupId == 'com.endeavorstreaming.androidx-media'
7979
boolean hasJar =
8080
jar_only_dependencies.contains(dependencyName)
8181
boolean hasAar =

publish-s3-maven.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# Check if a profile argument is provided
4+
if [[ -z "$1" ]]; then
5+
echo "Usage: $0 <aws-profile>"
6+
exit 1
7+
fi
8+
9+
# AWS profile to use for fetching credentials
10+
AWS_PROFILE="$1"
11+
12+
# Fetch credentials using AWS SSO and configure
13+
echo "Logging in to AWS SSO..."
14+
aws sso login --profile "$AWS_PROFILE"
15+
16+
# Fetch and export credentials in environment variable format
17+
echo "Fetching temporary AWS credentials..."
18+
credentials=$(aws configure export-credentials --profile "$AWS_PROFILE" --format env-no-export)
19+
20+
if [[ $? -ne 0 ]]; then
21+
echo "Failed to fetch credentials. Please ensure your profile is correctly configured."
22+
exit 1
23+
fi
24+
25+
# Parse and export the credentials as environment variables
26+
eval "$credentials"
27+
28+
# Confirm the variables are set
29+
echo "AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID"
30+
echo "AWS_SECRET_ACCESS_KEY: [hidden]"
31+
echo "AWS_SESSION_TOKEN: [hidden]"
32+
33+
# Optionally, verify with a simple AWS command
34+
aws sts get-caller-identity --profile "$AWS_PROFILE"
35+
if [[ $? -eq 0 ]]; then
36+
echo "AWS authentication successful."
37+
else
38+
echo "AWS authentication failed."
39+
exit 1
40+
fi
41+
42+
# Run Gradle publish task, passing AWS environment variables
43+
echo "Running Gradle publish task..."
44+
45+
# Pass the environment variables to the Gradle process
46+
AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
47+
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
48+
AWS_SESSION_TOKEN="$AWS_SESSION_TOKEN" \
49+
./gradlew publish -x test
50+
51+
# Check for success or failure of the gradle publish task
52+
if [[ $? -eq 0 ]]; then
53+
echo "Gradle publish completed successfully."
54+
else
55+
echo "Gradle publish failed."
56+
exit 1
57+
fi

publish.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ afterEvaluate {
2020
publishing {
2121
repositories {
2222
maven {
23-
url = findProperty('mavenRepo') ?: "${buildDir}/repo"
23+
url = System.getenv('AWS_S3_BUCKET_URL')
24+
credentials(AwsCredentials) {
25+
accessKey = System.getenv('AWS_ACCESS_KEY_ID')
26+
secretKey = System.getenv('AWS_SECRET_ACCESS_KEY')
27+
sessionToken = System.getenv('AWS_SESSION_TOKEN')
28+
}
2429
}
2530
}
2631
publications {
2732
release(MavenPublication) {
2833
from components.release
29-
groupId = 'androidx.media3'
34+
groupId = 'com.endeavorstreaming.androidx-media'
3035
artifactId = findProperty('releaseArtifactId') ?: ''
3136
version = findProperty('releaseVersion') ?: ''
3237
pom {

0 commit comments

Comments
 (0)