|
| 1 | +# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Check for new mlir-aie release |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + schedule: |
| 9 | + - cron: '0 10 * * *' # Run every day at 10 AM UTC (3 AM Mountain) |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + check-and-update: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: '3.x' |
| 26 | + |
| 27 | + - name: Get current mlir-aie version |
| 28 | + id: current_version |
| 29 | + run: | |
| 30 | + version=$(grep 'mlir_aie==' requirements.txt | cut -d'=' -f3) |
| 31 | + echo "Current version: $version" |
| 32 | + echo "version=$version" >> $GITHUB_OUTPUT |
| 33 | +
|
| 34 | + - name: Get latest mlir-aie release |
| 35 | + id: latest_release |
| 36 | + run: | |
| 37 | + latest_tag_with_v=$(curl -s "https://api.github.com/repos/Xilinx/mlir-aie/releases/latest" | jq '.tag_name') |
| 38 | + latest_tag=${latest_tag_with_v#v} |
| 39 | + echo "Latest tag: $latest_tag" |
| 40 | + echo "tag=$latest_tag" >> $GITHUB_OUTPUT |
| 41 | +
|
| 42 | + - name: Compare versions and create PR |
| 43 | + if: steps.current_version.outputs.version != steps.latest_release.outputs.tag |
| 44 | + env: |
| 45 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + run: | |
| 47 | + echo "New version found: ${{ steps.latest_release.outputs.tag }}. Current version is ${{ steps.current_version.outputs.version }}." |
| 48 | + |
| 49 | + # Configure git |
| 50 | + git config --global user.name 'github-actions[bot]' |
| 51 | + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' |
| 52 | + |
| 53 | + # Create new branch |
| 54 | + new_branch="update-mlir-aie-to-v${{ steps.latest_release.outputs.tag }}" |
| 55 | + git checkout -b $new_branch |
| 56 | + |
| 57 | + # Update requirements.txt |
| 58 | + sed -i "s|/v${{ steps.current_version.outputs.version }}/|/v${{ steps.latest_release.outputs.tag }}/|" requirements.txt |
| 59 | + |
| 60 | + # Commit changes |
| 61 | + git add requirements.txt |
| 62 | + git commit -m "Update mlir-aie to version ${{ steps.latest_release.outputs.tag }}" |
| 63 | + |
| 64 | + # Push changes |
| 65 | + git push --set-upstream origin $new_branch |
| 66 | + |
| 67 | + # Create Pull Request |
| 68 | + gh pr create --base main --head $new_branch --title "Update mlir-aie to v${{ steps.latest_release.outputs.tag }}" --body "This PR updates the mlir-aie version to the latest release." |
| 69 | + |
| 70 | + - name: No new version found |
| 71 | + if: steps.current_version.outputs.version == steps.latest_release.outputs.tag |
| 72 | + run: echo "mlir-aie is already at the latest version (${{ steps.current_version.outputs.version }})." |
0 commit comments