Last active
June 21, 2024 10:54
-
-
Save sassman/75b45999adff9d08c969d19e8276beca to your computer and use it in GitHub Desktop.
update rust dependencies minor versions made easy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## USAGE: | |
## - put this file into your $PATH e.g. /usr/local/bin | |
## - make it executable: chmod a+x /usr/local/bin/cargo-bump | |
## - in your rust project just call: cargo bump | |
BAK_BRANCH=$(git branch --show-current) | |
B=chore/update-minor-versions-$(date +'%Y-%m-%d') | |
# ensure the branch does not exist | |
git branch -D $B | |
git co -b $B o/main | |
# update several dependencies | |
CAPTION='chore(deps): update several dependencies' | |
echo "$CAPTION" > .msg | |
echo '```raw' >> .msg | |
cargo update 2>&1 \ | |
| grep -v 'Updating git repo' \ | |
| grep -v 'Blocking waiting' \ | |
| grep -v 'note: pass' \ | |
| grep -v 'Updating crates.io' >> .msg | |
echo '```' >> .msg | |
# commit the changes | |
git add Cargo.lock | |
git commit -F .msg | |
rm .msg | |
# create a PR | |
gh pr create --draft -F .msg -t "$CAPTION" | |
# go back to the original branch | |
git co $BAK_BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment