Skip to content

Auto-update SWIG Version #651

Auto-update SWIG Version

Auto-update SWIG Version #651

name: Auto-update SWIG Version
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1'
# pull_request_target:
# branches: [ main ]
jobs:
update-dep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check and update SWIG version
id: check-swig
run: |
old_version="$(grep -Po '(?<=SWIG_VERSION )\d+(\.\d+)+' swig_version.cmake)"
echo "Old version: $old_version"
echo "old_version=$old_version" >> $GITHUB_OUTPUT
new_version_raw=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/swig/swig/ 'v*.*.*'\
| tail --lines=1\
| cut --delimiter='/' --fields=3)
echo "New version (raw): $new_version_raw"
new_version=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/swig/swig/ 'v*.*.*'\
| tail --lines=1\
| cut --delimiter='/' --fields=3\
| grep -Po '\d+(\.\d+)+')
echo "New version: $new_version"
echo "new_version=$new_version" >> $GITHUB_OUTPUT
if [ "$old_version" != "$new_version" ]; then
echo "set(SWIG_VERSION $new_version)" > swig_version.cmake
echo "swig version updated"
else
echo "No change in swig version"
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update swig dependencies
title: Update SWIG version (${{ steps.check-swig.outputs.new_version }})
body: |
- Update SWIG version to ${{ steps.check-swig.outputs.new_version }}
Auto-generated by ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.job }}?check_suite_focus=true
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
branch: swig-version-update/${{ steps.check-swig.outputs.new_version }}