Auto-update LLVM Version #14
This file contains hidden or 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: Auto-update LLVM Version | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 10 * * 1' | |
| jobs: | |
| update-dep: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check and update LLVM version | |
| id: check-llvm | |
| run: | | |
| old_version="$(grep -Po '(?<=LLVM_VERSION )\d+(\.\d+)+' llvm_version.cmake)" | |
| echo "Old version: $old_version" | |
| echo "old_version=$old_version" >> $GITHUB_OUTPUT | |
| new_version=$(git -c 'versionsort.suffix=-' \ | |
| ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/llvm/llvm-project 'llvmorg-*.*.*'\ | |
| | grep -Po '\d+\.\d+(\.\d+)?$' \ | |
| | tail --lines=1) | |
| echo "New version: $new_version" | |
| echo "new_version=$new_version" >> $GITHUB_OUTPUT | |
| if [ "$old_version" != "$new_version" ]; then | |
| echo "set(LLVM_VERSION $new_version)" > llvm_version.cmake | |
| curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-${new_version}/clang-${new_version}.src.tar.xz -o clang-${new_version}.src.tar.xz | |
| hash=$(sha256sum clang-${new_version}.src.tar.xz | cut -d ' ' -f1) | |
| rm -f clang-${new_version}.src.tar.xz | |
| echo "set(LLVM_SHA256 $hash)" >> llvm_version.cmake | |
| echo "LLVM version updated" | |
| else | |
| echo "No change in LLVM version" | |
| fi | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: Update LLVM to version ${{ steps.check-llvm.outputs.new_version }} | |
| title: Update LLVM version (${{ steps.check-llvm.outputs.new_version }}) | |
| body: | | |
| - Update LLVM version to ${{ steps.check-llvm.outputs.new_version }} | |
| Auto-generated by ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.job }}?check_suite_focus=true | |
| author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
| branch: llvm-version-update/${{ steps.check-llvm.outputs.new_version }} |