automate byte-buddy build #8
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: "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 | |
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 | |
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 | |
sed -i "s|libs/byte-buddy-.+jar|libs/$tag.jar|" | |
echo updated byte buddy and reference | |
git add agent/libs | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git commit -m "rebuilt byte buddy" | |
git push | |
fi |