Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Make it easy for projects to automate homebrew PRs #46580

Closed
mdiep opened this issue Dec 2, 2015 · 10 comments
Closed

Make it easy for projects to automate homebrew PRs #46580

mdiep opened this issue Dec 2, 2015 · 10 comments

Comments

@mdiep
Copy link
Contributor

mdiep commented Dec 2, 2015

I'm one of the maintainers of Carthage. Every time we release a new version, someone needs to manually open a PR against homebrew to update to the latest version. It'd be really great if this was easily automatable for project maintainers as part of deployment. Carthage already uploads a new installer from Travis as part of the deployment process when a new tag is created. I'd love for updating homebrew to be just another automated step in that process.

I think this could be either:

  1. A webhook/service that's configurable on GitHub and listens to tags/releases and responds by creating a new PR against Homebrew.
  2. Some documentation and/or example scripts that project maintainers can add to Travis' deploy steps to automate opening a Homebrew PR.

At least in Carthage's case, updating homebrew means changing a SHA and a tag name. That seems like a great thing for a computer to do for us. ☺️

@MikeMcQuaid
Copy link
Member

CC @mislav and @FooBarWidget if you could elaborate how you've scripted this.

@FooBarWidget
Copy link
Contributor

The Passenger release script performs the following operations (simplified explanation):

  1. It creates a tarball.
  2. It clones the Homebrew repository.
  3. It modifies the Passenger formula, replacing the filename and SHA hash with that of the new tarball.
  4. It installs the locally-modified formula and the newly generated tarball, and runs brew install passenger to automatically test whether the formula works.
  5. If the test passes, it force-pushes to a Phusion-specific Homebrew fork repo.
  6. It uses the hub command to automatically send a pull request from phusion/homebrew to Homebrew/homebrew.
  7. It uploads the tarball to our file server.

@mislav
Copy link
Sponsor Contributor

mislav commented Dec 2, 2015

One of my scripts is here. Basically:

  1. Obtain the checksum for the tagged archive on GitHub
  2. Checkout Homebrew at the latest state of master branch
  3. Edit Library/Formula/NAME.rb by:
    • Substituting url field with new tarball location
    • Substituting sha256 field with new checksum
  4. Push the change to a new branch of your fork
  5. Open a PR for Homebrew. I use hub for this, but a generic script could use a manual approach. See below.
curl -H 'content-type: application/json' \
  -H "authorization: token $GITHUB_TOKEN" \
  https://api.github.com/repos/OWNER/REPO/pulls -d @- <<JSON
{ "title": "${program_name} ${version}",
  "head": "${fork_name}:${tmp_branch}",
  "base": "master" ]}
JSON

@mislav
Copy link
Sponsor Contributor

mislav commented Dec 2, 2015

I'd love to see a web service for this that could be triggered by CI or webhooks.

@zbeekman
Copy link
Contributor

zbeekman commented Dec 4, 2015

👍

@luzpaz
Copy link
Contributor

luzpaz commented Dec 19, 2015

👍

@MikeMcQuaid
Copy link
Member

PR opened in #46580 #49848 for the command. We'll consider a web service in future.

@zbeekman
Copy link
Contributor

zbeekman commented Mar 7, 2016

I think you meant #49848

@MikeMcQuaid
Copy link
Member

@zbeekman I did, thanks.

@MikeMcQuaid
Copy link
Member

Added as brew bump-formula-pr in #49848.

@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants