|
46 | 46 | echo "SONATYPE_USERNAME=$SONATYPE_USERNAME" >> $GITHUB_ENV |
47 | 47 | echo "SONATYPE_PASSWORD=$SONATYPE_PASSWORD" >> $GITHUB_ENV |
48 | 48 |
|
| 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 | +
|
49 | 91 | # Create the initial directory structure in repository |
50 | 92 | - name: Create grammar-poc directory structure in repository |
51 | 93 | run: | |
|
0 commit comments