https://github.com/mehermvr/bump_fetchcontent
Github action to bump dependency versions when using CMake FetchContent
https://github.com/mehermvr/bump_fetchcontent
action ci cmake fetchcontent github-actions
Last synced: about 2 months ago
JSON representation
Github action to bump dependency versions when using CMake FetchContent
- Host: GitHub
- URL: https://github.com/mehermvr/bump_fetchcontent
- Owner: mehermvr
- License: mit
- Created: 2025-10-03T14:11:07.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-10-03T16:26:12.000Z (8 months ago)
- Last Synced: 2025-10-10T20:47:56.521Z (8 months ago)
- Topics: action, ci, cmake, fetchcontent, github-actions
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bump_fetchcontent
GitHub Action that updates CMake FetchContent based dependencies.
Specifically, it does the following:
- looks through all `CMakeLists.txt` or `*.cmake` files in your repo
- searches for any [`FetchContent_Declare`](https://cmake.org/cmake/help/latest/module/FetchContent.html#command:fetchcontent_declare) calls
- checks if they use the URL style with a file ending in `.tar.gz`
- updates the url to a newer version if any
So it looks for dependencies like this:
```cmake
FetchContent_Declare(
someLib
URL https://github.com/user/repo/archive/refs/tags/v1.2.3.tar.gz
)
```
* Note: Only github and gitlab links are supported for now.
Of course, the URL style with a `.tar.gz` link is a very specific use case.
But that suffices for my own purposes for now.
Contributions welcome to support more cases.
## Example workflow
```yaml
name: Bump FetchContent
on:
schedule:
- cron: '0 0 1 * *' # run monthly on the 1st day at midnight UTC
workflow_dispatch: # allows manual trigger
jobs:
bump-fetchcontent:
runs-on: ubuntu-latest
steps:
- uses: mehermvr/bump_fetchcontent@v0.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
ignore_prereleases: 'true' # default behavior
```
## Inputs
- `github_token` (required): Should be available by default. Needed for making a PR if required.
- `ignore_prereleases` (optional): Skips pre-release versions like alpha, rc, or beta. Default is "true".
## Dry run
You can dry run the changes on your repo by using the file `dry_run.py`.
It takes a single argument which is your repository git url.
It'll clone the repo into a temp folder and check for version updates if any.