Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions bin/create-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -euo 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
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/nixos-shell 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
# make sure tag does not exist
if git tag -l | grep -q "^${version}\$"; then
echo "Tag ${version} already exists, exiting" >&2
exit 1
fi
echo "$version" > version.txt
git add version.txt
git commit -m "bump version ${version}"
git push origin main
git tag "${version}"
git push origin "${version}"
gh release create "${version}" --draft --title "${version}" --generate-notes
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

with pkgs;
stdenv.mkDerivation {
name = "nixos-shell";
name = "nixos-shell-${lib.fileContents ./version.txt}";
src = builtins.filterSource
(path: type: baseNameOf path != "nixos.qcow2" &&
baseNameOf path != ".git" &&
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
Loading