File tree Expand file tree Collapse file tree 5 files changed +84
-46
lines changed Expand file tree Collapse file tree 5 files changed +84
-46
lines changed Original file line number Diff line number Diff line change 1+ import requests
2+ import sys
3+ sys .path .append ('../../' )
4+ from clang_tools import release_tag
5+
6+
7+ def get_latest_tag () -> str :
8+ response = requests .get ("https://api.github.com/repos/cpp-linter/clang-tools-static-binaries/releases/latest" )
9+ return response .json ()['tag_name' ]
10+
11+
12+ def update_tag (current_tag , latest_tag ) -> None :
13+ file_path = "../../clang_tools/__init__.py"
14+ with open (file_path ) as file :
15+ file_content = file .read ()
16+
17+ updated_content = file_content .replace (current_tag , latest_tag )
18+
19+ with open (file_path , 'w' ) as file :
20+ file .write (updated_content )
21+
22+
23+ if __name__ == "__main__" :
24+ latest_tag = get_latest_tag ()
25+ current_tag = release_tag
26+
27+ if latest_tag != current_tag :
28+ update_tag (current_tag , latest_tag )
29+
30+ print (latest_tag )
Original file line number Diff line number Diff line change 1+ name : Bump clang-tools binaries version
2+ on :
3+ push :
4+ branches :
5+ - " main"
6+ schedule :
7+ # Run once a day
8+ - cron : ' 0 0 * * *'
9+ workflow_dispatch :
10+
11+ jobs :
12+ bump_version :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - name : Set up Python
18+ uses : actions/setup-python@v5
19+ with :
20+ python-version : ' 3.x'
21+
22+ - name : Install dependencies
23+ run : pip install requests
24+
25+ - name : Bump version
26+ id : bump
27+ run : |
28+ cd .github/workflows
29+ bump_tag=`python3 bump-version.py`
30+ echo "bump_tag=$bump_tag" >> $GITHUB_OUTPUT
31+
32+ cd ${{ github.workspace }}
33+
34+ if git diff --exit-code; then
35+ echo "No changes detected."
36+ exit 0
37+ fi
38+
39+ - name : Create Pull Request
40+ uses : peter-evans/create-pull-request@v5
41+ with :
42+ add-paths : " clang_tools/__init__.py"
43+ commit-message : " chore: bump clang-tools-static-binaries to ${{ steps.bump.outputs.bump_tag }}"
44+ title : " Bump cpp-linter/clang-tools-static-binaries to ${{ steps.bump.outputs.bump_tag }}"
45+ body : |
46+ Bump [cpp-linter/clang-tools-static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries/releases) to `${{ steps.bump.outputs.bump_tag }}`
47+ - This PR was auto-generated by [create-pull-request][1]
48+
49+ [1]: https://github.com/peter-evans/create-pull-request
50+ base : main
51+ labels : dependencies
52+ branch : bump-clang-tools-static-binaries-version
53+ delete-branch : true
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2020 hooks :
2121 - id : flake8
2222 args : [--max-line-length=120]
23+ exclude : ^(.github/workflows/bump-version.py)
2324 # - repo: local
2425 # hooks:
2526 # - id: pytest
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments