Skip to content

Create flow for automating byte-buddy version bump #16

Create flow for automating byte-buddy version bump

Create flow for automating byte-buddy version bump #16

Workflow file for this run

name: "Byte Buddy Update"
on:
pull_request:
permissions:
pull-requests: write
contents: write
jobs:
pr-api-change:
name: PR Byte Buddy change
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
- name: Rebuild byte-buddy if version has changed
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ 'byte-buddy-tag' = $(git diff --diff-filter=d --name-only origin/master -- 'byte-buddy-tag' agent/libs | xargs) ]
then
echo Byte Buddy tag was updated
tag=$(cat byte-buddy-tag)
rm agent/libs/byte-buddy*
git clone https://github.com/raphw/byte-buddy.git
cp bb.patch byte-buddy
cd byte-buddy
git checkout $tag
git apply bb.patch
mvn clean package -Pextras -Dskiptests -q -B
echo Build succeeded
mv ./byte-buddy/target/$tag.jar ../agent/libs
mv ./byte-buddy/target/$tag-sources.jar ../agent/libs
cd ..
rm -rf byte-buddy
perl -pi -e "s|libs/byte-buddy-.+jar|libs/$tag.jar|" agent/build.gradle
echo updated byte buddy and reference
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
echo set origin url to https://github.com/$GITHUB_REPOSITORY
git fetch
git checkout -b update_byte_buddy-tag-$tag
git add agent/libs agent/build.gradle
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -m "rebuilt byte buddy"
git push -f origin update_byte_buddy-tag-$tag
gh pr create -B master -H update_byte_buddy-tag-$tag --fill && echo Update PR successfully made || echo PR is already open
fi