mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-11 10:35:43 +03:00
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|
cd "$SCRIPT_DIR/.."
|
|
|
|
version=${1:-}
|
|
if [[ -z "$version" ]]; then
|
|
echo "USAGE: $0 version" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$(git symbolic-ref --short HEAD)" != "master" ]]; then
|
|
echo "must be on master branch" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# ensure we are up-to-date
|
|
uncommitted_changes=$(git diff --compact-summary)
|
|
if [[ -n "$uncommitted_changes" ]]; then
|
|
echo -e "There are uncommitted changes, exiting:\n${uncommitted_changes}" >&2
|
|
exit 1
|
|
fi
|
|
git pull git@github.com:Mic92/nix-update master
|
|
unpushed_commits=$(git log --format=oneline origin/master..master)
|
|
if [[ "$unpushed_commits" != "" ]]; then
|
|
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
|
|
exit 1
|
|
fi
|
|
sed -i -e "s!^version = \".*\"\$!version = \"${version}\"!" pyproject.toml default.nix
|
|
git add pyproject.toml default.nix
|
|
nix flake check -vL
|
|
nix develop -c pytest -s .
|
|
git commit -m "bump version ${version}"
|
|
git tag -e "${version}"
|
|
|
|
echo "now run 'git push --tags origin master'"
|