Skip to content

Commit ef59484

Browse files
Mic92mergify[bot]
authored andcommitted
add release script
1 parent 24f2d37 commit ef59484

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

scripts/create-release.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu -o pipefail
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
6+
cd "$SCRIPT_DIR/.."
7+
8+
version=${1:-}
9+
if [[ -z $version ]]; then
10+
echo "USAGE: $0 version" >&2
11+
exit 1
12+
fi
13+
14+
if [[ "$(git symbolic-ref --short HEAD)" != "main" ]]; then
15+
echo "must be on main branch" >&2
16+
exit 1
17+
fi
18+
19+
# ensure we are up-to-date
20+
uncommitted_changes=$(git diff --compact-summary)
21+
if [[ -n $uncommitted_changes ]]; then
22+
echo -e "There are uncommitted changes, exiting:\n${uncommitted_changes}" >&2
23+
exit 1
24+
fi
25+
git pull git@github.com:nix-community/nixos-anywhere main
26+
unpushed_commits=$(git log --format=oneline origin/main..main)
27+
if [[ $unpushed_commits != "" ]]; then
28+
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
29+
exit 1
30+
fi
31+
sed -i -e "s!version = \".*\"\$!version = \"${version}\"!" default.nix
32+
git add src/default.nix
33+
nix-shell -p nix-fast-build --command "nix-fast-build --eval-workers 2"
34+
git commit -m "bump version ${version}"
35+
git tag "${version}"
36+
37+
echo "now run 'git push --tags origin main'"

0 commit comments

Comments
 (0)