nightlark / swig-pypi

pip install swig. SWIG Python wheel for PyPI.
Apache License 2.0
16 stars 5 forks source link

Automated check for new swig releases #18

Closed nightlark closed 3 years ago

nightlark commented 3 years ago

swig releases new versions relatively infrequently -- it would be nice to have a GitHub Action workflow that runs on a set schedule to see if a new swig version has been tagged, and open an issue or a PR updating the swig version for this package.

This could probably be done using a bash script that extracts the latest tag from git ls-remote --sort=version:refname --tags https://github.com/swig/swig or a curl request to https://github.com/swig/swig/releases, updates the swig version number to pull for building this package, then uses the GitHub CLI gh pr create command to open a PR with the update.

rbSparky commented 3 years ago

I would like to work on this issue. Could you assign it to me?

nightlark commented 3 years ago

Alright, there you go!

rbSparky commented 3 years ago

Hello @nightlark, I just wanted to give you a small update. This is the command that gets the newest swig 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

v4.0.2

I'll make it run in the .yml file on a regular basis(a week maybe?)

Also, Github warned me against enabling Github Actions in my forked repo, so I have only allowed specified actions in my own branch(rbSparky/swig-pypi@testing) I hope thats enough to not push changes to the other repos(pypa) through your .yml file. Please let me know if I need to change some other setting too.

I had been working on automating pull requests using Actions, but I got an error(Can't find 'action.yml', 'action.yaml' or 'Dockerfile') I'll work on trying to fix that.

I also wanted to ask in what file do I need to update the swig version in the project?

nightlark commented 3 years ago

Once or twice a week sounds like a good frequency.

The warning about enabling actions in your forked repo is more about making sure you don't end up forking a repository with an action that is doing something malicious like running a bitcoin miner under your account -- there shouldn't be any concerns with accidentally pushing changes to PyPI since it depends on having a secret configured with the right token, which are not shared with workflows running in forks.

I had been working on automating pull requests using Actions, but I got an error(Can't find 'action.yml', 'action.yaml' or 'Dockerfile') I'll work on trying to fix that.

I think the issue is probably that it is trying to use the testing branch of the rbSparky/swig-pypi repository as an action for opening the PR. From the looks of the with: arguments used, I think you want uses: peter-evans/create-pull-request@v3 instead since https://github.com/peter-evans/create-pull-request is the repository containing the code that does the PR creation.

I also wanted to ask in what file do I need to update the swig version in the project?

Good question... I'll add (or you can add) a swig_version.cmake file in the root of the repository containing a line that looks like:

set(SWIG_VERSION 4.0.0)

Then updating the version is just replacing the entire line, and a regex or some string manipulation can be used to pull out the version number from that line.

rbSparky commented 3 years ago

Hello @nightlark, I have made the following updates in my fork(in the swig-update branch).

I have created a file swig-update-autocheck.yml in the workflows directory which is scheduled to run every week and runs a bash script that checks for any version updates(from the swig github repo) and checks current version in the .cmake file(using regex), updates the version in swig_version.cmake when needed and issues a PR.

Please let me know if anything needs to be fixed and if I should issue a PR myself to merge with your main repo.

nightlark commented 3 years ago

Awesome! Yea you should open a PR (that way it will count towards Hacktoberfest for you once it’s merged), and I’ll leave a review on the PR with any changes/suggestions.

On Sunday, October 3, 2021, rbSparky @.***> wrote:

Hello @nightlark https://github.com/nightlark, I have made the following updates in my fork(in the swig-update branch).

I have created a file swig-update-autocheck.yml in the workflows which is scheduled to run every week and run a bash script that checks for any version updates(using regex), updates the version in swig_version.cmake when needed and issues a PR.

Please let me know if anything needs to be fixed and if I should issue a PR myself to merge with your main repo.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nightlark/swig-pypi/issues/18#issuecomment-932882144, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6JBZ4YEU5YWV3VJ7JQ6OLUFACRLANCNFSM5DXXR5WQ .

rbSparky commented 3 years ago

Thanks @nightlark, I've opened the PR.