diff options
| author | Egor Tensin <egor@tensin.name> | 2026-09-14 17:31:57 +0500 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-09-14 17:31:57 +0500 |
| commit | 679b070c0d5f2a6968e8352ff3d34a287520b99c (patch) | |
| tree | 2cf89c0117a807690b0202c2bfe577c667aaea59 /.github/maintenance.sh | |
| parent | bump dependencies (diff) | |
| download | jekyll-theme-679b070c0d5f2a6968e8352ff3d34a287520b99c.tar.gz jekyll-theme-679b070c0d5f2a6968e8352ff3d34a287520b99c.zip | |
Makefile: move out maintenance stuff into a separate script
Diffstat (limited to '.github/maintenance.sh')
| -rwxr-xr-x | .github/maintenance.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/.github/maintenance.sh b/.github/maintenance.sh new file mode 100755 index 0000000..0a66204 --- /dev/null +++ b/.github/maintenance.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail +shopt -s inherit_errexit lastpipe + +script_path="$( readlink --canonicalize-existing -- "${BASH_SOURCE[0]}" )" +readonly script_path +script_dir="$( dirname -- "$script_path" )" +readonly script_dir + +update_gems() { + echo + echo ====================================================================== + echo Updating gems + echo ====================================================================== + bundle config set frozen false + bundle update + echo ---------------------------------------------------------------------- +} + +push_changes() { + echo + echo ====================================================================== + echo Pushing changes + echo ====================================================================== + + local git_status + git_status="$( git status --porcelain=v1 )" + + if [ -z "$git_status" ]; then + echo 'No changes.' + echo ---------------------------------------------------------------------- + return + fi + + if [ "$git_status" != ' M Gemfile.lock' ]; then + echo 'Error: unrecognized modifications in the repository:' + echo "$git_status" + echo ---------------------------------------------------------------------- + return 1 + fi + + git commit -am 'bump dependencies' + git push -q + echo ---------------------------------------------------------------------- +} + +main() { + cd -- "$script_dir/.." + update_gems + push_changes +} + +main |
