Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -ex
# This script should be run at the root of the repository.
# This script is used to update googleapis_commitish, gapic_generator_version,
# and libraries_bom_version in generation configuration at the time of running
Expand All @@ -15,8 +15,10 @@ set -e
function get_latest_released_version() {
local group_id=$1
local artifact_id=$2
json_content=$(curl -s "https://search.maven.org/solrsearch/select?q=g:${group_id}+AND+a:${artifact_id}&core=gav&rows=500&wt=json")
latest=$(jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v' <<< "${json_content}" | sort -V | tail -n 1)
group_id_url_path="$(sed 's|\.|/|g' <<< "${group_id}")"
url="https://repo1.maven.org/maven2/${group_id_url_path}/${artifact_id}/maven-metadata.xml"
xml_content=$(curl -s --fail "${url}")
latest=$(xmllint --xpath 'metadata/versioning/latest/text()' - <<< "${xml_content}")
if [[ -z "${latest}" ]]; then
echo "The latest version of ${group_id}:${artifact_id} is empty."
echo "The returned json from maven.org is invalid: ${json_content}"
Expand Down Expand Up @@ -172,4 +174,4 @@ if [ -z "${pr_num}" ]; then
else
git push
gh pr edit "${pr_num}" --title "${title}" --body "${title}"
fi
fi
7 changes: 4 additions & 3 deletions .github/workflows/update_generation_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:

jobs:
update-generation-config:
runs-on: ubuntu-24.04
Expand All @@ -30,6 +29,9 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- name: Install Dependencies
shell: bash
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Update params in generation config to latest
shell: bash
run: |
Expand All @@ -40,5 +42,4 @@ jobs:
--base_branch "${base_branch}" \
--repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}