Skip to content

Commit d2ab5be

Browse files
chore: use composite action to generate library (#2735)
* chore: use composite action to generate library * chore: generate libraries at Wed Sep 25 20:07:49 UTC 2024 --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
1 parent 66a4c7f commit d2ab5be

File tree

4 files changed

+28
-137
lines changed

4 files changed

+28
-137
lines changed

.github/scripts/hermetic_library_generation.sh

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/hermetic_library_generation.yaml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,29 @@ on:
1919
paths:
2020
- 'generation_config.yaml'
2121

22-
2322
env:
24-
HEAD_REF: ${{ github.head_ref }}
2523
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
2624
GITHUB_REPOSITORY: ${{ github.repository }}
27-
2825
jobs:
2926
library_generation:
3027
runs-on: ubuntu-latest
3128
steps:
29+
- name: Determine whether the pull request comes from a fork
30+
run: |
31+
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
32+
echo "This PR comes from a fork. Skip library generation."
33+
echo "SHOULD_RUN=false" >> $GITHUB_ENV
34+
else
35+
echo "SHOULD_RUN=true" >> $GITHUB_ENV
36+
fi
3237
- uses: actions/checkout@v4
38+
if: env.SHOULD_RUN == 'true'
3339
with:
3440
fetch-depth: 0
3541
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
36-
- name: Generate changed libraries
37-
shell: bash
38-
run: |
39-
set -ex
40-
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
41-
echo "This PR comes from a fork. Generation will be skipped"
42-
exit 0
43-
fi
44-
[ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com"
45-
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
46-
bash .github/scripts/hermetic_library_generation.sh \
47-
--target_branch ${{ github.base_ref }} \
48-
--current_branch $HEAD_REF
49-
env:
50-
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
42+
- uses: googleapis/sdk-platform-java/.github/scripts@v2.46.0
43+
if: env.SHOULD_RUN == 'true'
44+
with:
45+
base_ref: ${{ github.base_ref }}
46+
head_ref: ${{ github.head_ref }}
47+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>libraries-bom</artifactId>
22-
<version>26.45.0</version>
22+
<version>26.47.0</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>
@@ -47,12 +47,12 @@ If you are using Maven without the BOM, add this to your dependencies:
4747
<dependency>
4848
<groupId>com.google.cloud</groupId>
4949
<artifactId>google-cloud-storage</artifactId>
50-
<version>2.42.0</version>
50+
<version>2.43.0</version>
5151
</dependency>
5252
<dependency>
5353
<groupId>com.google.cloud</groupId>
5454
<artifactId>google-cloud-storage-control</artifactId>
55-
<version>2.42.0</version>
55+
<version>2.43.0</version>
5656
</dependency>
5757

5858
```

renovate.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
"matchStrings": ["uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v(?<currentValue>.+?)\\n"],
3030
"depNameTemplate": "com.google.cloud:sdk-platform-java-config",
3131
"datasourceTemplate": "maven"
32+
},
33+
{
34+
"fileMatch": [
35+
".github/workflows/hermetic_library_generation.yaml"
36+
],
37+
"matchStrings": [
38+
"uses: googleapis/sdk-platform-java/.github/scripts@v(?<currentValue>.+?)\\n"
39+
],
40+
"depNameTemplate": "com.google.api:gapic-generator-java",
41+
"datasourceTemplate": "maven"
3242
}
3343
],
3444
"packageRules": [

0 commit comments

Comments
 (0)