Skip to content

Commit ef9c246

Browse files
authored
chore: Making automated version updates in readme.md (#9150)
* chore: Making automated version updates in readme.md
1 parent 5fd6f61 commit ef9c246

File tree

147 files changed

+360
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+360
-2
lines changed

generation/new_client/new-client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,14 @@ def generate(
359359
cwd=monorepo_root,
360360
)
361361

362+
print("Adding annotations in readme")
363+
subprocess.check_call(
364+
[
365+
"bash", "generation/readme_update.sh"
366+
],
367+
cwd=monorepo_root,
368+
)
369+
362370
print(f"Prepared new library in {workdir}")
363371
print(f"Please create a pull request:\n"
364372
f" $ git checkout -b new_module_java-{output_name}\n"

generation/readme_update.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
# This script should run as a part of new-library generation process.
3+
# This script introduces release-please annotations if they don't exist in the readme file
4+
5+
for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml | sort | xargs dirname); do
6+
7+
if [[ "${module}" = *java-core ]] || [[ "${module}" = *java-shared-dependencies ]]; then
8+
continue
9+
fi
10+
11+
readme_file="${module}/README.md"
12+
13+
if [ -e ${readme_file} ] && ! [[ $(grep "x-version-update-start" ${readme_file}) ]]; then
14+
15+
artifactId_line=$(grep --max-count=1 'artifactId' "${readme_file}")
16+
17+
prefix=" <artifactId>"
18+
suffix="</artifactId>"
19+
string=${artifactId_line}
20+
new_string=${string#"$prefix"}
21+
artifactId=${new_string%"$suffix"}
22+
23+
echo "Handling ${artifactId}"
24+
25+
line_number=$(grep -n -m 1 "<dependency>" ${readme_file} | sed 's/\([0-9]*\).*/\1/')
26+
start_line=${line_number}-2
27+
line_number_end=$(grep -n -m 1 "Scala" ${readme_file} | sed 's/\([0-9]*\).*/\1/')
28+
end_line=${line_number_end}+4
29+
30+
start_line_append="<!-- {x-version-update-start:${artifactId}:released} -->"
31+
32+
printf '%s\n' H ${start_line}i "${start_line_append}" . w | ed -s ${readme_file}
33+
printf '%s\n' H ${end_line}i "<!-- {x-version-update-end} -->" . w | ed -s ${readme_file}
34+
35+
fi
36+
37+
done

java-accessapproval/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Java idiomatic client for [Access Approval][product-docs].
1313

1414

1515
If you are using Maven, add this to your pom.xml file:
16-
1716
<!--- {x-version-update-start:google-cloud-accessapproval:released} -->
1817

1918
```xml
@@ -23,7 +22,6 @@ If you are using Maven, add this to your pom.xml file:
2322
<version>2.12.0</version>
2423
</dependency>
2524
```
26-
<!--- {x-version-update-end} -->
2725

2826
If you are using Gradle without BOM, add this to your dependencies:
2927

@@ -36,6 +34,7 @@ If you are using SBT, add this to your dependencies:
3634
```Scala
3735
libraryDependencies += "com.google.cloud" % "google-cloud-accessapproval" % "2.10.0"
3836
```
37+
<!--- {x-version-update-end} -->
3938

4039

4140
## Authentication

java-accesscontextmanager/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Java idiomatic client for [Identity Access Context Manager][product-docs].
1414

1515
If you are using Maven, add this to your pom.xml file:
1616

17+
<!--- {x-version-update-start:google-identity-accesscontextmanager:released} -->
1718

1819
```xml
1920
<dependency>
@@ -34,6 +35,7 @@ If you are using SBT, add this to your dependencies:
3435
```Scala
3536
libraryDependencies += "com.google.cloud" % "google-identity-accesscontextmanager" % "1.9.0"
3637
```
38+
<!--- {x-version-update-end} -->
3739

3840
## Authentication
3941

java-aiplatform/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Java idiomatic client for [Vertex AI][product-docs].
1414

1515
If you are using Maven, add this to your pom.xml file:
1616

17+
<!--- {x-version-update-start:google-cloud-aiplatform:released} -->
1718

1819
```xml
1920
<dependency>
@@ -34,6 +35,7 @@ If you are using SBT, add this to your dependencies:
3435
```Scala
3536
libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.10.0"
3637
```
38+
<!--- {x-version-update-end} -->
3739

3840
## Authentication
3941

java-analytics-admin/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Java idiomatic client for [Analytics Admin][product-docs].
1717

1818
If you are using Maven, add this to your pom.xml file:
1919

20+
<!--- {x-version-update-start:google-analytics-admin:released} -->
2021

2122
```xml
2223
<dependency>
@@ -37,6 +38,7 @@ If you are using SBT, add this to your dependencies:
3738
```Scala
3839
libraryDependencies += "com.google.analytics" % "google-analytics-admin" % "0.20.0"
3940
```
41+
<!--- {x-version-update-end} -->
4042

4143
## Authentication
4244

java-analytics-data/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Java idiomatic client for [Analytics Data][product-docs].
1717

1818
If you are using Maven, add this to your pom.xml file:
1919

20+
<!--- {x-version-update-start:google-analytics-data:released} -->
2021

2122
```xml
2223
<dependency>
@@ -37,6 +38,7 @@ If you are using SBT, add this to your dependencies:
3738
```Scala
3839
libraryDependencies += "com.google.analytics" % "google-analytics-data" % "0.19.0"
3940
```
41+
<!--- {x-version-update-end} -->
4042

4143
## Authentication
4244

java-analyticshub/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Java idiomatic client for [Analytics Hub API][product-docs].
1717

1818
If you are using Maven, add this to your pom.xml file:
1919

20+
<!--- {x-version-update-start:google-cloud-analyticshub:released} -->
2021

2122
```xml
2223
<dependency>
@@ -37,6 +38,7 @@ If you are using SBT, add this to your dependencies:
3738
```Scala
3839
libraryDependencies += "com.google.cloud" % "google-cloud-analyticshub" % "0.6.0"
3940
```
41+
<!--- {x-version-update-end} -->
4042

4143
## Authentication
4244

java-api-gateway/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Java idiomatic client for [API Gateway][product-docs].
1414

1515
If you are using Maven, add this to your pom.xml file:
1616

17+
<!--- {x-version-update-start:google-cloud-api-gateway:released} -->
1718

1819
```xml
1920
<dependency>
@@ -34,6 +35,7 @@ If you are using SBT, add this to your dependencies:
3435
```Scala
3536
libraryDependencies += "com.google.cloud" % "google-cloud-api-gateway" % "2.9.0"
3637
```
38+
<!--- {x-version-update-end} -->
3739

3840
## Authentication
3941

java-apigee-connect/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Java idiomatic client for [Apigee Connect][product-docs].
1414

1515
If you are using Maven, add this to your pom.xml file:
1616

17+
<!--- {x-version-update-start:google-cloud-apigee-connect:released} -->
1718

1819
```xml
1920
<dependency>
@@ -34,6 +35,7 @@ If you are using SBT, add this to your dependencies:
3435
```Scala
3536
libraryDependencies += "com.google.cloud" % "google-cloud-apigee-connect" % "2.9.0"
3637
```
38+
<!--- {x-version-update-end} -->
3739

3840
## Authentication
3941

0 commit comments

Comments
 (0)