@@ -16,6 +16,17 @@ if [[ "$(git symbolic-ref --short HEAD)" != "main" ]]; then
1616 exit 1
1717fi
1818
19+ waitForPr () {
20+ local pr=$1
21+ while true ; do
22+ if gh pr view " $pr " | grep -q ' MERGED' ; then
23+ break
24+ fi
25+ echo " Waiting for PR to be merged..."
26+ sleep 5
27+ done
28+ }
29+
1930# ensure we are up-to-date
2031uncommitted_changes=$( git diff --compact-summary)
2132if [[ -n " $uncommitted_changes " ]]; then
@@ -28,11 +39,34 @@ if [[ "$unpushed_commits" != "" ]]; then
2839 echo -e " \nThere are unpushed changes, exiting:\n$unpushed_commits " >&2
2940 exit 1
3041fi
42+ # make sure tag does not exist
43+ if git tag -l | grep -q " ^${version} \$ " ; then
44+ echo " Tag ${version} already exists, exiting" >&2
45+ exit 1
46+ fi
3147sed -i -e " s!^version = \" .*\"\$ !version = \" ${version} \" !" Cargo.toml
3248cargo build
3349git add Cargo.lock Cargo.toml
50+ git branch -D " release-${version} " || true
51+ git checkout -b " release-${version} "
3452nix flake check -vL
3553git commit -m " bump version nix-ld ${version} "
36- git tag " ${version} "
54+ git push origin " release-${version} "
55+ pr_url=$( gh pr create \
56+ --base main \
57+ --head " release-${version} " \
58+ --title " Release ${version} " \
59+ --body " Release ${version} of nix-ld" )
3760
38- echo " now run 'git push --tags origin main'"
61+ # Extract PR number from URL
62+ pr_number=$( echo " $pr_url " | grep -oE ' [0-9]+$' )
63+
64+ # Enable auto-merge with specific merge method and delete branch
65+ gh pr merge " $pr_number " --auto --merge --delete-branch
66+ git checkout main
67+
68+ waitForPr " release-${version} "
69+ git pull
[email protected] :nix-community/nix-ld main
70+ git tag " ${version} "
71+ git push --tags origin
72+ gh release create " ${version} " --draft --title " ${version} " --notes " "
0 commit comments