Skip to content

feat: bump clang-tools-static-binaries tag with github action #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/bump-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import requests
import sys
sys.path.append('../../')
from clang_tools import release_tag


def get_latest_tag() -> str:
response = requests.get("https://api.github.com/repos/cpp-linter/clang-tools-static-binaries/releases/latest")
return response.json()['tag_name']


def update_tag(current_tag, latest_tag) -> None:
file_path = "../../clang_tools/__init__.py"
with open(file_path) as file:
file_content = file.read()

updated_content = file_content.replace(current_tag, latest_tag)

with open(file_path, 'w') as file:
file.write(updated_content)


if __name__ == "__main__":
latest_tag = get_latest_tag()
current_tag = release_tag

if latest_tag != current_tag:
update_tag(current_tag, latest_tag)

print(latest_tag)
53 changes: 53 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Bump clang-tools binaries version
on:
push:
branches:
- "main"
schedule:
# Run once a day
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
bump_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: pip install requests

- name: Bump version
id: bump
run: |
cd .github/workflows
bump_tag=`python3 bump-version.py`
echo "bump_tag=$bump_tag" >> $GITHUB_OUTPUT

cd ${{ github.workspace }}

if git diff --exit-code; then
echo "No changes detected."
exit 0
fi

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
add-paths: "clang_tools/__init__.py"
commit-message: "chore: bump clang-tools-static-binaries to ${{ steps.bump.outputs.bump_tag }}"
title: "Bump cpp-linter/clang-tools-static-binaries to ${{ steps.bump.outputs.bump_tag }}"
body: |
Bump [cpp-linter/clang-tools-static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries/releases) to `${{ steps.bump.outputs.bump_tag }}`
- This PR was auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request
base: main
labels: dependencies
branch: bump-clang-tools-static-binaries-version
delete-branch: true
18 changes: 0 additions & 18 deletions .github/workflows/renovatebot.yml

This file was deleted.

1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ repos:
hooks:
- id: flake8
args: [--max-line-length=120]
exclude: ^(.github/workflows/bump-version.py)
# - repo: local
# hooks:
# - id: pytest
Expand Down
28 changes: 0 additions & 28 deletions renovate.json

This file was deleted.