-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbump-input
More file actions
executable file
·42 lines (36 loc) · 1.13 KB
/
bump-input
File metadata and controls
executable file
·42 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
#First, make sure we are in a git repo
(git rev-parse --show-toplevel) || (echo "Not in a git repository" && exit 1)
# Get the input name into a variable
INPUTNAME=${1}
if [[ $INPUTNAME == "*" ]]; then
_BUMP_ALL_INPUTS=1
else
_BUMP_ALL_INPUTS=0
fi
# Start
if [[ ${_BUMP_ALL_INPUTS} == 1 ]]; then
echo "⬆️ Bumping all inputs"
else
echo "⬆️ Bumping input ${INPUTNAME}"
fi
# Optional validation -- abort if there's an uncommitted write to flake.lock
# if [[ $(cd "$GIT_ROOT" && git status --porcelain flake.lock) ]]; then
# echo "❌flake.lock has uncommitted changes. Commit before proceeding"
# exit 1
# fi
echo "❄️ Invoking nix flake command"
if [[ ${_BUMP_ALL_INPUTS} == 1 ]]; then
nix flake update \
--commit-lock-file \
--commit-lockfile-summary "[ci]: bumping all inputs"
else
# NOTE: new-ish `nix` versions will prompt to use `nix flake update $INPUTNAME`
# TODO: [24.05]?
nix flake lock \
--update-input "${INPUTNAME}" \
--commit-lock-file \
--commit-lockfile-summary "[ci]: bumping ${INPUTNAME}"
fi
echo "✅ All done!"
exit 0