automate byte-buddy build #10
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 -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 | |
git checkout "${GITHUB_HEAD_REF}" | |
git add agent/libs agent/build.gradle | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github_actions_bot@kamon.io" | |
git commit -m "rebuilt byte buddy" | |
git push | |
fi |