@@ -77,6 +77,13 @@ def run
7777 puts blog_post_notes
7878 end
7979
80+ ohai "Creating tag #{ new_version } "
81+ safe_system "git" , "-C" , HOMEBREW_REPOSITORY , "tag" , "-a" , new_version , "-m" , "Release #{ new_version } "
82+ safe_system "git" , "-C" , HOMEBREW_REPOSITORY , "push" , "origin" , new_version
83+
84+ # Get the commit SHA for the tag
85+ tag_sha = Utils . safe_popen_read ( "git" , "-C" , HOMEBREW_REPOSITORY , "rev-parse" , new_version ) . strip
86+
8087 ohai "Creating draft release for version #{ new_version } "
8188
8289 release_notes = if args . major? || args . minor?
@@ -93,6 +100,60 @@ def run
93100 odie "Unable to create release: #{ e . message } !"
94101 end
95102
103+ ohai "Triggering pkg-installer workflow for #{ new_version } "
104+ begin
105+ GitHub . workflow_dispatch_event ( "Homebrew" , "brew" , "pkg-installer.yml" , new_version , tag : new_version )
106+ rescue *GitHub ::API ::ERRORS => e
107+ opoo "Unable to trigger workflow: #{ e . message } "
108+ opoo "You may need to manually trigger the pkg-installer workflow."
109+ end
110+
111+ ohai "Waiting for pkg-installer workflow to complete..."
112+ opoo "This may take several minutes. You can monitor progress at:"
113+ puts "https://github.com/Homebrew/brew/actions/workflows/pkg-installer.yml"
114+
115+ # Poll for workflow completion
116+ max_attempts = 60 # 30 minutes (30 seconds * 60)
117+ attempt = 0
118+ workflow_completed = false
119+
120+ while attempt < max_attempts
121+ sleep 30
122+ attempt += 1
123+
124+ # Check workflow runs for the commit SHA
125+ begin
126+ runs_url = "#{ GitHub ::API_URL } /repos/Homebrew/brew/actions/workflows/pkg-installer.yml/runs"
127+ response = GitHub ::API . open_rest ( "#{ runs_url } ?head_sha=#{ tag_sha } &per_page=1" )
128+
129+ if response [ "workflow_runs" ] &.any?
130+ run = response [ "workflow_runs" ] . first
131+ status = run [ "status" ]
132+ conclusion = run [ "conclusion" ]
133+
134+ if status == "completed"
135+ if conclusion == "success"
136+ ohai "Workflow completed successfully!"
137+ workflow_completed = true
138+ else
139+ opoo "Workflow completed with status: #{ conclusion } "
140+ opoo "Check the workflow run at: #{ run [ "html_url" ] } "
141+ end
142+ break
143+ elsif ( attempt % 4 ) . zero?
144+ print "."
145+ end
146+ end
147+ rescue *GitHub ::API ::ERRORS => e
148+ opoo "Error checking workflow status: #{ e . message } " if attempt == 1
149+ end
150+ end
151+
152+ unless workflow_completed
153+ opoo "Workflow did not complete in time or failed."
154+ opoo "Please check the workflow status before publishing the release."
155+ end
156+
96157 puts release [ "html_url" ]
97158 exec_browser release [ "html_url" ]
98159 end
0 commit comments