Skip to content

Commit 98c8ef6

Browse files
authored
Merge pull request #518 from nix-community/merge-when-green-joerg
rework release script to work with merge queues
2 parents a0fd2b7 + 3ba658d commit 98c8ef6

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

scripts/create-release.sh

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
77
cd "$SCRIPT_DIR/.."
8+
readonly repo_url="git@github.com:nix-community/nixos-anywhere"
89

910
version=${1:-}
1011
if [[ -z $version ]]; then
@@ -23,16 +24,38 @@ if [[ -n $uncommitted_changes ]]; then
2324
echo -e "There are uncommitted changes, exiting:\n${uncommitted_changes}" >&2
2425
exit 1
2526
fi
26-
git pull git@github.com:nix-community/nixos-anywhere main
27+
git pull "$repo_url" main
2728
unpushed_commits=$(git log --format=oneline origin/main..main)
28-
if [[ $unpushed_commits != "" ]]; then
29+
if [[ -n $unpushed_commits ]]; then
2930
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
3031
exit 1
3132
fi
33+
34+
git branch -D "release-${version}" || true
35+
git checkout -b "release-${version}"
36+
3237
sed -i -e "s!version = \".*\";!version = \"${version}\";!" src/default.nix
3338
git add src/default.nix
34-
nix-shell -p nix-fast-build --command "nix-fast-build --eval-workers 2"
39+
3540
git commit -m "bump version ${version}"
36-
git tag "${version}"
41+
git push origin "release-${version}"
42+
gh pr create \
43+
--base main \
44+
--head "release-${version}" \
45+
--title "Release ${version}" \
46+
--body "Release ${version} of nixpkgs-review" \
47+
--merge \
48+
--delete-branch
49+
50+
gh pr merge --auto "release-${version}"
51+
git checkout main
3752

38-
echo "now run 'git push --tags origin main'"
53+
while true; do
54+
if gh pr view "release-${version}" | grep -q 'MERGED'; then
55+
break
56+
fi
57+
echo "Waiting for PR to be merged..."
58+
sleep 5
59+
done
60+
git pull "$repo_url" main
61+
gh release create "${version}" --draft --title "${version}" --notes ""

0 commit comments

Comments
 (0)