Skip to content

Commit 5eb2e5b

Browse files
authored
Modified workflow, Added new language-grammar directory (opensearch-project#3715)
1 parent df9f5dd commit 5eb2e5b

15 files changed

Lines changed: 7223 additions & 25 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Script to retrieve Sonatype credentials from AWS Secrets Manager
3+
4+
SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
5+
SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
6+
echo "::add-mask::$SONATYPE_USERNAME"
7+
echo "::add-mask::$SONATYPE_PASSWORD"
8+
echo "SONATYPE_USERNAME=$SONATYPE_USERNAME" >> $GITHUB_ENV
9+
echo "SONATYPE_PASSWORD=$SONATYPE_PASSWORD" >> $GITHUB_ENV

.github/workflows/maven-publish.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- 1.*
99
- 2.*
1010

11+
env:
12+
SNAPSHOT_REPO_URL: https://aws.oss.sonatype.org/content/repositories/snapshots/
13+
1114
jobs:
1215
build-and-publish-snapshots:
1316
strategy:
@@ -30,33 +33,11 @@ jobs:
3033
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
3134
aws-region: us-east-1
3235

33-
# Create the initial direct-query directory structure
34-
- name: Create direct-query directory structure in repository
36+
- name: get credentials
3537
run: |
3638
# Get credentials for publishing
37-
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
38-
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
39-
echo "::add-mask::$SONATYPE_USERNAME"
40-
echo "::add-mask::$SONATYPE_PASSWORD"
41-
42-
# Create a placeholder file
43-
TEMP_DIR=$(mktemp -d)
44-
echo "Directory placeholder - $(date)" > "${TEMP_DIR}/.placeholder"
45-
46-
# Upload the placeholder file to create the directory structure
47-
echo "Creating initial directory structure..."
48-
curl -X PUT -u "${SONATYPE_USERNAME}:${SONATYPE_PASSWORD}" \
49-
--upload-file "${TEMP_DIR}/.placeholder" \
50-
"https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/direct-query/.placeholder"
51-
52-
# Clean up
53-
rm -rf "${TEMP_DIR}"
54-
echo "Directory structure created"
39+
.github/get-sonatype-credentials.sh
5540
5641
- name: publish snapshots to maven
5742
run: |
58-
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
59-
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
60-
echo "::add-mask::$SONATYPE_USERNAME"
61-
echo "::add-mask::$SONATYPE_PASSWORD"
62-
./gradlew publishPluginZipPublicationToSnapshotsRepository
43+
./gradlew publishPluginZipPublicationToSnapshotsRepository

0 commit comments

Comments
 (0)