Skip to content

Commit

Permalink
chore: use composite action to generate library (#2735)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
JoeWang1127 and cloud-java-bot authored Sep 25, 2024
1 parent 66a4c7f commit d2ab5be
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 137 deletions.
116 changes: 0 additions & 116 deletions .github/scripts/hermetic_library_generation.sh

This file was deleted.

33 changes: 15 additions & 18 deletions .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,29 @@ on:
paths:
- 'generation_config.yaml'


env:
HEAD_REF: ${{ github.head_ref }}
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
GITHUB_REPOSITORY: ${{ github.repository }}

jobs:
library_generation:
runs-on: ubuntu-latest
steps:
- name: Determine whether the pull request comes from a fork
run: |
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
echo "This PR comes from a fork. Skip library generation."
echo "SHOULD_RUN=false" >> $GITHUB_ENV
else
echo "SHOULD_RUN=true" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
if: env.SHOULD_RUN == 'true'
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- name: Generate changed libraries
shell: bash
run: |
set -ex
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
echo "This PR comes from a fork. Generation will be skipped"
exit 0
fi
[ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com"
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
bash .github/scripts/hermetic_library_generation.sh \
--target_branch ${{ github.base_ref }} \
--current_branch $HEAD_REF
env:
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- uses: googleapis/sdk-platform-java/.github/scripts@v2.46.0
if: env.SHOULD_RUN == 'true'
with:
base_ref: ${{ github.base_ref }}
head_ref: ${{ github.head_ref }}
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.45.0</version>
<version>26.47.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -47,12 +47,12 @@ If you are using Maven without the BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.42.0</version>
<version>2.43.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage-control</artifactId>
<version>2.42.0</version>
<version>2.43.0</version>
</dependency>

```
Expand Down
10 changes: 10 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
"matchStrings": ["uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v(?<currentValue>.+?)\\n"],
"depNameTemplate": "com.google.cloud:sdk-platform-java-config",
"datasourceTemplate": "maven"
},
{
"fileMatch": [
".github/workflows/hermetic_library_generation.yaml"
],
"matchStrings": [
"uses: googleapis/sdk-platform-java/.github/scripts@v(?<currentValue>.+?)\\n"
],
"depNameTemplate": "com.google.api:gapic-generator-java",
"datasourceTemplate": "maven"
}
],
"packageRules": [
Expand Down

0 comments on commit d2ab5be

Please sign in to comment.