File tree Expand file tree Collapse file tree 4 files changed +63
-4
lines changed
Expand file tree Collapse file tree 4 files changed +63
-4
lines changed Original file line number Diff line number Diff line change 1818 branches :
1919 - main
2020 pull_request :
21- name : unmanaged versions check
21+ name : versions check
2222jobs :
23- check :
23+ unmanaged-versions- check :
2424 runs-on : ubuntu-latest
2525 steps :
2626 - uses : actions/checkout@v3
27- - run : ./generation/check_non_release_please_versions.sh
27+ - run : ./generation/check_non_release_please_versions.sh
28+
29+ # For Release Please pull requests, the artifacts being published must not
30+ # have the duplicate versions in Maven Central
31+ existing-versions-check :
32+ runs-on : ubuntu-latest
33+ if : github.repository_owner == 'googleapis' && github.head_ref == 'release-please--branches--main'
34+ steps :
35+ - run : sudo apt-get update -y
36+ - run : sudo apt-get install libxml2-utils
37+ - uses : actions/checkout@v3
38+ - run : ./generation/check_existing_release_versions.sh
Original file line number Diff line number Diff line change 984984 <version >2.6.1-SNAPSHOT</version ><!-- {x-version-update:grafeas:current} -->
985985 </dependency >
986986 <dependency >
987- <groupId >com.google.cloud</groupId >
987+ <groupId >com.google.cloud</groupId >
988988 <artifactId >google-cloud-notification</artifactId >
989989 <version >0.123.22-beta-SNAPSHOT</version ><!-- {x-version-update:google-cloud-notification:current} -->
990990 </dependency >
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Using Google Mirror to avoid unnecessary load to https://repo1.maven.org/maven2
4+ MAVEN_SITE=https://maven-central.storage-download.googleapis.com/maven2
5+
6+ set -e
7+
8+ function find_existing_version_pom() {
9+ local pom_file=$1
10+ if [ -z " ${pom_file} " ]; then
11+ echo " Empty pom file name"
12+ exit 1
13+ fi
14+ local group_id=$( xmllint --xpath ' /*[local-name()="project"]/*[local-name()="groupId"]/text()' \
15+ " ${pom_file} " )
16+ local artifact_id=$( xmllint --xpath ' /*[local-name()="project"]/*[local-name()="artifactId"]/text()' \
17+ " ${pom_file} " )
18+ local version=$( xmllint --xpath ' /*[local-name()="project"]/*[local-name()="version"]/text()' \
19+ " ${pom_file} " )
20+ echo -n " Checking ${group_id} :${artifact_id} :${version} :"
21+ if [ -z " ${group_id} " ] || [ -z " ${artifact_id} " ] || [ -z " ${version} " ]; then
22+ echo " Couldn't parse the pom file: $pom_file "
23+ exit 1
24+ fi
25+ if [[ " ${version} " == * SNAPSHOT* ]] && [ " ${artifact_id} " != " google-cloud-java" ]; then
26+ echo " Release Please pull request contains SNAPSHOT version. Please investigate."
27+ return_code=1
28+ fi
29+ local group_id_dir=" ${group_id// \. // } "
30+ local URL=" ${MAVEN_SITE} /${group_id_dir} /${artifact_id} /${version} /${artifact_id} -${version} .pom"
31+ local status_code=$( curl --silent --head -o /dev/null -w " %{http_code}" $URL )
32+ if [ " ${status_code} " == " 404" ]; then
33+ echo " The version does not exists. Good"
34+ else
35+ echo " The version already exists at ${URL} . Please investigate."
36+ return_code=1
37+ fi
38+
39+ }
40+
41+ return_code=0
42+
43+ for pom_file in $( find . -maxdepth 3 -name pom.xml| sort --dictionary-order) ; do
44+ find_existing_version_pom " ${pom_file} "
45+ done
46+
47+ exit ${return_code}
Original file line number Diff line number Diff line change 33 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
44 xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
55 <modelVersion >4.0.0</modelVersion >
6+ <groupId >com.google.cloud</groupId >
67 <artifactId >google-cloud-notification</artifactId >
78 <version >0.123.22-beta-SNAPSHOT</version ><!-- {x-version-update:google-cloud-notification:current} -->
89 <packaging >jar</packaging >
You can’t perform that action at this time.
0 commit comments