fix(deps): update dependency com.google.cloud:libraries-bom to v26.19.0 (main) #457
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Spring Auto-Configurations | |
on: | |
workflow_dispatch: | |
inputs: | |
branch_name: | |
description: PR branch name | |
required: true | |
default: "renovate/main-gcp-libraries-bom.version" | |
forked_repo: | |
description: Fork name (enter none if repo branch) | |
required: true | |
default: "renovate-bot/GoogleCloudPlatform-_-spring-cloud-gcp" | |
pull_request: | |
types: [opened] | |
jobs: | |
generateLibraries: | |
# Run this if workflow is manually triggered | |
# On initial opening of renovate or dependabot PR with matching branch condition, | |
# log information required for manually triggering workflow and exit with error to block PR | |
if: ${{ (github.event_name == 'workflow_dispatch') || startsWith(github.head_ref, 'renovate/main-gcp-libraries-bom.version') || startsWith(github.head_ref, 'dependabot/maven/com.google.cloud-libraries-bom') }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get PR info | |
id: get_pr_info | |
continue-on-error: false | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
echo "Please trigger update workflow manually. The following information may be helpful: " | |
echo "PR head repo full name: $HEAD_REPO_NAME" | |
echo "PR base repo full name: $BASE_REPO_NAME" | |
echo "PR branch name: $PR_BRANCH_NAME" | |
echo "Actor from PR event: $GITHUB_ACTOR" | |
exit 1 | |
env: | |
HEAD_REPO_NAME: ${{ github.event.pull_request.head.repo.full_name }} | |
BASE_REPO_NAME: ${{ github.event.pull_request.base.repo.full_name }} | |
PR_BRANCH_NAME: ${{ github.head_ref }} | |
- name: Get libraries bom version | |
id: get_libraries_bom_version | |
continue-on-error: false | |
# Fetch updated pom file with the new libraries-bom version. | |
# This step differs slightly depending on whether the workflow is triggered for a forked repo. | |
run: | | |
set -x | |
sudo apt-get update | |
sudo apt-get install libxml2-utils | |
if [[ ${{ github.event.inputs.forked_repo }} != "none" ]]; then | |
git fetch https://github.com/${{ github.event.inputs.forked_repo }}.git ${{ github.event.inputs.branch_name }} | |
git checkout FETCH_HEAD -- spring-cloud-gcp-dependencies/pom.xml | |
else | |
git fetch origin ${{ github.event.inputs.branch_name }} | |
git checkout origin/${{ github.event.inputs.branch_name }} -- spring-cloud-gcp-dependencies/pom.xml | |
fi | |
echo "LIBRARIES_BOM_VERSION=$(xmllint --xpath "string(//*[local-name()='gcp-libraries-bom.version'])" spring-cloud-gcp-dependencies/pom.xml)" >> $GITHUB_OUTPUT | |
- name: Setup Java 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: bazelisk version | |
- uses: actions/setup-go@v3 | |
- name: Install buildozer | |
run: | | |
go install github.com/bazelbuild/buildtools/buildozer@latest | |
export PATH=$PATH:$(go env GOPATH)/bin | |
buildozer --version | |
- name: Compile non-autogen libraries | |
continue-on-error: false | |
run: | | |
set -e | |
./mvnw \ | |
--batch-mode \ | |
--show-version \ | |
--threads 1.5C \ | |
--define maven.test.skip=true \ | |
--define maven.javadoc.skip=true \ | |
install | |
- name: Generate libraries | |
continue-on-error: false | |
working-directory: spring-cloud-generator | |
run: | | |
set -x | |
set -e | |
export PATH=$PATH:$(go env GOPATH)/bin | |
buildozer --version | |
bash scripts/generate.sh | |
env: | |
LIBRARIES_BOM_VERSION: ${{ steps.get_libraries_bom_version.outputs.LIBRARIES_BOM_VERSION }} | |
- name: Sanity checks | |
continue-on-error: false | |
working-directory: spring-cloud-generator | |
run: | | |
set -x | |
bash scripts/sanity-checks.sh | |
- name: Check for generation errors | |
continue-on-error: false | |
working-directory: spring-cloud-generator | |
run: | | |
set -xe | |
if [[ ! -d failed-library-generations ]] || [[ $(ls *failed-library-generations | wc -l) -eq 0 ]]; then | |
echo 'no errors at generation' | |
exit 0 | |
fi | |
for failed_lib_name in $(find failed-library-generations -printf '%f\n' | tail -n+2); do | |
echo "***** FAILED TO GENERATE LIBRARY: $failed_lib_name" | |
cat failed-library-generations/$failed_lib_name | |
done | |
exit 1 | |
#Compares the current contents of spring-cloud-previews with the new generated libraries | |
- name: Detect changes | |
id: detect_changes | |
run: | | |
set -x | |
# Counts number of changed files | |
git add ./spring-cloud-previews | |
CHANGED_FILES=`git diff --cached --numstat | wc -l | awk '{print $1}'` | |
git reset -- ./spring-cloud-previews # unstage changes | |
echo "$CHANGED_FILES have changed after generation" | |
if [[ $CHANGED_FILES -eq 0 ]]; then | |
echo "Branch will not be updated" | |
fi | |
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_OUTPUT | |
- name: Push commit to branch | |
if: steps.detect_changes.outputs.CHANGED_FILES > 0 | |
run: | | |
set -x | |
# stashes the changes from generated libs | |
git stash push -- spring-cloud-previews/ | |
# configure author | |
git config --global user.name "Cloud Java Bot" | |
git config --global user.email "[email protected]" | |
# push changes to branch | |
if [[ ${{ github.event.inputs.forked_repo }} != "none" ]]; then | |
git fetch https://github.com/${{ github.event.inputs.forked_repo }}.git ${{ github.event.inputs.branch_name }} | |
git checkout FETCH_HEAD | |
git stash pop | |
git add ./spring-cloud-previews | |
git commit -m "chore: update starter modules in spring-cloud-previews" | |
git push https://github.com/${{ github.event.inputs.forked_repo }}.git HEAD:${{ github.event.inputs.branch_name }} | |
else | |
git fetch origin ${{ github.event.inputs.branch_name }} | |
git checkout ${{ github.event.inputs.branch_name }} | |
git reset --hard | |
git stash pop | |
git add ./spring-cloud-previews | |
git commit -m "chore: update starter modules in spring-cloud-previews" | |
git push -u origin ${{ github.event.inputs.branch_name }} | |
fi | |
env: | |
GITHUB_ACTOR_EMAIL: ${{ steps.determine_workflow_author_email.outputs.GITHUB_ACTOR_EMAIL }} | |
GITHUB_ACTOR_NAME: ${{ steps.determine_workflow_author_email.outputs.GITHUB_ACTOR_NAME }} | |
GITHUB_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }} |