Skip to content
Merged
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
38 changes: 33 additions & 5 deletions bin/create-release.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash

set -eu -o pipefail
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$SCRIPT_DIR/.."

version=${1:-}
version="${1:-}"
if [[ -z $version ]]; then
echo "USAGE: $0 version" >&2
exit 1
Expand All @@ -16,6 +16,17 @@ if [[ "$(git symbolic-ref --short HEAD)" != "master" ]]; then
exit 1
fi

waitForPr() {
local pr=$1
while true; do
if gh pr view "$pr" | grep -q 'MERGED'; then
break
fi
echo "Waiting for PR to be merged..."
sleep 5
done
}

# ensure we are up-to-date
uncommitted_changes=$(git diff --compact-summary)
if [[ -n $uncommitted_changes ]]; then
Expand All @@ -28,10 +39,27 @@ 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
sed -i -e "s!^version = \".*\"\$!version = \"${version}\"!" pyproject.toml
git add pyproject.toml
nix flake check -vL
git branch -D "release-${version}" || true
git checkout -b "release-${version}"
git commit -m "bump version ${version}"
git tag "${version}"
git push origin "release-${version}"
gh pr create \
--base master \
--head "release-${version}" \
--title "Release ${version}" \
--body "Release ${version} of nix-direnv"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nix-direnv?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


echo "now run 'git push --tags origin master'"
gh pr merge --auto "release-${version}"

waitForPr "release-${version}"
git checkout master
git pull git@github.com:Mic92/nixpkgs-review master
git tag "${version}"
git push origin "${version}"