-
Notifications
You must be signed in to change notification settings - Fork 7
/
create-release.sh
executable file
·37 lines (31 loc) · 1009 Bytes
/
create-release.sh
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
#!/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)" != "main" ]]; then
echo "must be on main branch" >&2
exit 1
fi
# ensure we are up-to-date
uncommited_changes=$(git diff --compact-summary)
if [[ -n "$uncommited_changes" ]]; then
echo -e "There are uncommited changes, exiting:\n${uncommited_changes}" >&2
exit 1
fi
git pull git@github.com:Mic92/ssh-to-age main
unpushed_commits=$(git log --format=oneline origin/main..main)
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}\"!" default.nix
git add default.nix
nix-build --no-out-link default.nix
git commit -m "bump version ${version}"
git tag -e "${version}"
echo 'now run `git push --tags origin main`'