|
| 1 | +# Copyright (C) 2025 Intel Corporation |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Daily update vLLM & vLLM-fork version |
| 5 | + |
| 6 | +on: |
| 7 | + schedule: |
| 8 | + - cron: "30 22 * * *" |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +env: |
| 12 | + BRANCH_NAME: "update" |
| 13 | + USER_NAME: "CICD-at-OPEA" |
| 14 | + |
| 15 | + |
| 16 | +jobs: |
| 17 | + freeze-tag: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - repo: vLLM |
| 23 | + repo_name: vllm-project/vllm |
| 24 | + ver_name: VLLM_VER |
| 25 | + - repo: vLLM-fork |
| 26 | + repo_url: HabanaAI/vllm-fork |
| 27 | + ver_name: VLLM_FORK_VER |
| 28 | + permissions: |
| 29 | + contents: write |
| 30 | + pull-requests: write |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + ref: ${{ github.ref }} |
| 37 | + |
| 38 | + - name: Set up Git |
| 39 | + run: | |
| 40 | + git config --global user.name ${{ env.USER_NAME }} |
| 41 | + git config --global user.email ${{ env.USER_EMAIL }} |
| 42 | + git remote set-url origin https://${{ env.USER_NAME }}:"${{ secrets.ACTION_TOKEN }}"@github.com/${{ github.repository }}.git |
| 43 | + git fetch |
| 44 | +
|
| 45 | + if git ls-remote https://github.com/${{ github.repository }}.git "refs/heads/${{ env.BRANCH_NAME }}_${{ matrix.repo }}" | grep -q "refs/heads/${{ env.BRANCH_NAME }}_${{ matrix.repo }}"; then |
| 46 | + echo "branch ${{ env.BRANCH_NAME }}_${{ matrix.repo }} exists" |
| 47 | + git checkout ${{ env.BRANCH_NAME }}_${{ matrix.repo }} |
| 48 | + else |
| 49 | + echo "branch ${{ env.BRANCH_NAME }}_${{ matrix.repo }} not exists" |
| 50 | + git checkout -b ${{ env.BRANCH_NAME }}_${{ matrix.repo }} |
| 51 | + git push origin ${{ env.BRANCH_NAME }}_${{ matrix.repo }} |
| 52 | + echo "branch ${{ env.BRANCH_NAME }}_${{ matrix.repo }} created successfully" |
| 53 | + fi |
| 54 | +
|
| 55 | + - name: Run script |
| 56 | + run: | |
| 57 | + latest_vllm_ver=$(curl -s "https://api.github.com/repos/${{ matrix.repo_name }}/tags" | jq '.[0].name' -) |
| 58 | + echo "latest_vllm_ver=${latest_vllm_ver}" >> "$GITHUB_ENV" |
| 59 | + find . -type f \( -name "*.sh" -o -name "_build_image.yml" \) -exec sed -i "s/${{ matrix.ver_name }}=.*/${{ matrix.ver_name }}=${latest_vllm_ver}/" {} \; |
| 60 | +
|
| 61 | + - name: Commit changes |
| 62 | + run: | |
| 63 | + git add . |
| 64 | + if git diff-index --quiet HEAD --; then |
| 65 | + echo "No changes detected, skipping commit." |
| 66 | + exit 1 |
| 67 | + else |
| 68 | + git commit -s -m "Update ${{ matrix.repo }} version to ${latest_vllm_ver}" |
| 69 | + git push |
| 70 | + fi |
| 71 | +
|
| 72 | + - name: Create Pull Request |
| 73 | + run: | |
| 74 | + pr_count=$(curl -H "Authorization: token ${{ secrets.ACTION_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/pulls?state=all&head=${{ env.USER_NAME }}:${{ env.BRANCH_NAME }}_${{ matrix.repo }}" | jq '. | length') |
| 75 | + if [ $pr_count -gt 0 ]; then |
| 76 | + echo "Pull Request exists" |
| 77 | + pr_number=$(curl -H "Authorization: token ${{ secrets.ACTION_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/pulls?state=all&head=${{ env.USER_NAME }}:${{ env.BRANCH_NAME }}_${{ matrix.repo }}" | jq '.[0].number') |
| 78 | + curl -X PATCH -H "Authorization: token ${{ secrets.ACTION_TOKEN }}" -d "{ |
| 79 | + \"title\":\"Update ${{ matrix.repo }} version to ${latest_vllm_ver}\", |
| 80 | + \"body\":\"Update ${{ matrix.repo }} version to ${latest_vllm_ver}\", |
| 81 | + \"state\":\"open\" |
| 82 | + }" "https://api.github.com/repos/${{ github.repository }}/pulls/${pr_number}" |
| 83 | + echo "Pull Request updated successfully" |
| 84 | + else |
| 85 | + echo "Pull Request not exists..." |
| 86 | + curl -H "Authorization: token ${{ secrets.ACTION_TOKEN }}" -d "{ |
| 87 | + \"title\":\"Update ${{ matrix.repo }} version to ${latest_vllm_ver}\", |
| 88 | + \"body\":\"Update ${{ matrix.repo }} version to ${latest_vllm_ver}\", |
| 89 | + \"head\":\"${{ env.USER_NAME }}:${{ env.BRANCH_NAME }}_${{ matrix.repo }}\", |
| 90 | + \"base\":\"main\" |
| 91 | + }" "https://api.github.com/repos/${{ github.repository }}/pulls" |
| 92 | + echo "Pull Request created successfully" |
| 93 | + fi |
0 commit comments