Skip to content

Commit 74447a2

Browse files
committed
cleaning up
Signed-off-by: Kai Huang <ahkcs@amazon.com>
1 parent 555e0b0 commit 74447a2

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/maven-publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,48 @@ jobs:
4646
echo "SONATYPE_USERNAME=$SONATYPE_USERNAME" >> $GITHUB_ENV
4747
echo "SONATYPE_PASSWORD=$SONATYPE_PASSWORD" >> $GITHUB_ENV
4848
49+
# Clean up old directories
50+
- name: Delete existing directories
51+
run: |
52+
# Helper function to delete a directory and its contents
53+
delete_directory() {
54+
local dir_url=$1
55+
echo "Attempting to delete directory: $dir_url"
56+
57+
# Check if directory exists with a HEAD request
58+
status_code=$(curl -s -o /dev/null -w "%{http_code}" -u "${SONATYPE_USERNAME}:${SONATYPE_PASSWORD}" -X HEAD "${dir_url}")
59+
60+
if [[ "$status_code" == "200" || "$status_code" == "301" || "$status_code" == "302" || "$status_code" == "307" ]]; then
61+
echo "Directory exists, deleting: $dir_url"
62+
63+
# Use DELETE request to remove the directory
64+
curl -s -u "${SONATYPE_USERNAME}:${SONATYPE_PASSWORD}" -X DELETE "${dir_url}"
65+
echo "Deletion request sent for: $dir_url"
66+
else
67+
echo "Directory doesn't exist or not accessible (status code: $status_code): $dir_url"
68+
fi
69+
}
70+
71+
# List of directories to delete
72+
directories=(
73+
"${SNAPSHOT_REPO_URL}org/opensearch/language-grammar/"
74+
"${SNAPSHOT_REPO_URL}org/opensearch/direct-query-poc2/"
75+
"${SNAPSHOT_REPO_URL}org/opensearch/direct-query/"
76+
"${SNAPSHOT_REPO_URL}org/opensearch/language-grammar-poc2/"
77+
"${SNAPSHOT_REPO_URL}org/opensearch/opensearch-language-grammar-poc/"
78+
"${SNAPSHOT_REPO_URL}org/opensearch/opensearch-language-grammar-poc2/"
79+
"${SNAPSHOT_REPO_URL}org/opensearch/opensearch-spark-ppl_2.12/0.8.0-commit-metadata-poc-SNAPSHOT-SNAPSHOT/"
80+
"${SNAPSHOT_REPO_URL}org/opensearch/opensearch-spark-sql-application_2.12//0.8.0-commit-metadata-poc-SNAPSHOT-SNAPSHOT/"
81+
"${SNAPSHOT_REPO_URL}org/opensearch/opensearch-spark-standalone_2.12/0.8.0-commit-metadata-poc-SNAPSHOT-SNAPSHOT/"
82+
)
83+
84+
# Delete each directory
85+
for dir in "${directories[@]}"; do
86+
delete_directory "$dir"
87+
done
88+
89+
echo "Directory cleanup completed"
90+
4991
# Create the initial directory structure in repository
5092
- name: Create grammar-poc directory structure in repository
5193
run: |

0 commit comments

Comments
 (0)