• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    TypeScript
  • License
    The Unlicense
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically bump Homebrew formula after a release

An action that bumps a Homebrew formula after a new release.

Minimal usage example:

on:
  push:
    tags: 'v*'

jobs:
  homebrew:
    name: Bump Homebrew formula
    runs-on: ubuntu-latest
    steps:
      - uses: mislav/bump-homebrew-formula-action@v2
        with:
          # A PR will be sent to github.com/Homebrew/homebrew-core to update this formula:
          formula-name: my_formula
        env:
          COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}

The COMMITTER_TOKEN secret is required because this action will want to write to an external repository. You can generate a new PAT here and give it public_repo (or repo if the homebrew tap repository is private) scopes.

Comprehensive usage example:

on:
  push:
    tags: 'v*'

jobs:
  homebrew:
    name: Bump Homebrew formula
    runs-on: ubuntu-latest
    steps:
      - name: Extract version
        id: extract-version
        run: |
          printf "::set-output name=%s::%s\n" tag-name "${GITHUB_REF#refs/tags/}"
      - uses: mislav/bump-homebrew-formula-action@v2
        if: "!contains(github.ref, '-')" # skip prereleases
        with:
          formula-name: my_formula
          formula-path: Formula/my_formula.rb
          homebrew-tap: Homebrew/homebrew-core
          base-branch: master
          download-url: https://example.com/foo/${{ steps.extract-version.outputs.tag-name }}.tar.gz
          commit-message: |
            {{formulaName}} {{version}}

            Created by https://github.com/mislav/bump-homebrew-formula-action
        env:
          COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
          # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

You should enable GITHUB_TOKEN only if the repository that runs this Action is private and if COMMITTER_TOKEN has the public_repo scope only. GITHUB_TOKEN will be used for verifying the SHA256 sum of the downloadable archive for this release.

Action inputs

Formula parameters:

  • formula-name: the name of the Homebrew formula to bump. Defaults to lower-cased repository name.

  • formula-path: the relative path of the Homebrew formula file to edit within the homebrew-tap repository. Defaults to Formula/<formula-name>.rb.

  • tag-name: the git tag name to bump the formula to. Defaults to the currently pushed tag.

  • download-url: the package download URL for the Homebrew formula.

    Defaults to https://github.com/OWNER/REPO/archive/<tag-name>.tar.gz, where OWNER/REPO is the repository that is running the Actions workflow.

  • download-sha256: the SHA256 checksum of the archive at download-url. Defaults to calculating the checksum by fetching the archive at run time.

Repository parameters:

  • homebrew-tap: the full GitHub repository name (in the NAME/OWNER format) where the Homebrew formula should be updated. Defaults to Homebrew/homebrew-core.

  • push-to: a specific fork of homebrew-tap where the edit should be pushed to. Defaults to creating or reusing a personal fork of the owner of COMMITTER_TOKEN.

  • base-branch: the branch name in the homebrew-tap repository where the formula should be updated. Defaults to the main branch of the repository.

  • create-pullrequest: a boolean value to either force or prohibit submitting a pull request to homebrew-tap. Defaults to false if COMMITTER_TOKEN has the privileges to directly push to base-branch in homebrew-tap.

  • commit-message: the git commit message template to use when updating the formula. The following placeholders be expanded:

    Placeholder Description
    {{formulaName}} the name of the formula supplied in formula-name
    {{version}} the version number for this release

    It's recommended that commit-message has both subject and body, i.e. that it contains a subject line followed by a blank line followed by body text. Otherwise, pull requests to Homebrew/homebrew-core might get denied by their automation.

    Defaults to:

    {{formulaName}} {{version}}
    
    Created by https://github.com/mislav/bump-homebrew-formula-action
    

How it works

Given a Homebrew formula Formula/my_formula.rb in the homebrew-core repo:

class MyFormula < Formula
  url "https://github.com/me/myproject/archive/v1.2.3.tar.gz"
  sha256 "<OLDSHA>"
  # ...
end

After we push a v2.0.0 git tag to a project that has this action configured, the formula will be updated to:

class MyFormula < Formula
  url "https://github.com/me/myproject/archive/v2.0.0.tar.gz"
  sha256 "<NEWSHA>"
  # ...
end

This action can update the following Homebrew formula fields:

  • version
  • url
  • sha256 - for non-git download-url
  • tag - for git-based download-url
  • revision - for git-based download-url

If the current COMMITTER_TOKEN doesn't have push access to the repo specified by the homebrew-tap input, the formula will be edited in a fork that is automatically created, and a pull request will be opened.

If the token has push access, but the default branch of the tap repo is protected, a pull request will be opened from a new branch in the same repo.

Otherwise, the formula will be edited via a direct push to the default branch. This can be overriden by setting create-pullrequest.

Manual trigger

Here's an example of how to set up this action to be manually triggered instead of being triggered by pushing to a git tag:

on:
  workflow_dispatch:
    inputs:
      tag-name:
        description: 'The git tag name to bump the formula to'
        required: true

jobs:
  homebrew:
    name: Bump Homebrew formula
    runs-on: ubuntu-latest
    steps:
      - uses: mislav/bump-homebrew-formula-action@v2
        with:
          formula-name: my_formula
          tag-name: ${{ github.event.inputs.tag-name }}
          download-url: https://example.com/foo/${{ github.event.inputs.tag-name }}.tar.gz
        env:
          COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}

More Repositories

1

hub

A command-line tool that makes git easier to use with GitHub.
Go
22,524
star
2

will_paginate

Pagination library for Rails and other Ruby applications
Ruby
5,706
star
3

git-deploy

git deployment made easy
Ruby
2,098
star
4

dotfiles

bash, zsh, git, tmux, personal toolbox
Shell
1,208
star
5

rfc

Pretty RFC indexes and reformats RFC documents for easier discovery and viewing.
JavaScript
935
star
6

poignant-guide

Why's Poignant Guide to Ruby
HTML
732
star
7

instagram

The first Instagram website and lightweight API HTTP client
Ruby
586
star
8

ssl-tools

Ruby tools to help with debugging certificates for SSL connections
Ruby
339
star
9

contacts

Ruby library for consuming Google, Yahoo!, Flickr and Windows Live contact APIs
Ruby
294
star
10

anyenv

rbenv-inspired version manager that can be configured to manage versions of ANYTHING
Go
273
star
11

vimfiles

vim configuration – Ruby, Rails, Markdown, SCSS, CoffeeScript
Vim Script
266
star
12

hanna

More than just a new RDoc template
Ruby
234
star
13

gh-branch

GitHub CLI extension for fuzzy finding, quickly switching between and deleting branches.
Shell
210
star
14

nibbler

A cute HTML scraper / data extraction tool in under 70 lines of code
Ruby
141
star
15

coral

Hacker's toolbelt for Ruby, gems, Bundler, git, and more
Shell
108
star
16

choices

Easy external settings for your app
Ruby
95
star
17

gorgeous

Convert between different data formats: JSON, XML, YAML, Ruby, email, URL-encoded
Ruby
94
star
18

movieapp

Mark movies you watched, liked, or plan to watch, and share with your friends.
Ruby
79
star
19

diveintohtml5

[STALE] Copy of Mark Pilgrim's book "Dive Into HTML5"
HTML
75
star
20

gh-cp

GitHub CLI extension to copy a file from a GitHub repository locally without cloning the repository.
Shell
72
star
21

issuesync

Downloads all issues for the current project to individual `issues/*.md` files
Ruby
67
star
22

twitter-login

Login through Twitter; DEPRECATED in favor of omniauth-twitter.
Ruby
63
star
23

rspec-rails-mocha

Ports functionality of mock_model and stub_model from rspec-rails for developers using Mocha.
Ruby
57
star
24

hub-api-utils

A collection of `hub api` examples
Shell
57
star
25

bluecloth

Markdown processor in Ruby; foked from official SVN repo to fix bugs
Ruby
49
star
26

faraday-stack

[deprecated] Über Faraday stack for consuming APIs (JSON, XML decoding & more)
Ruby
47
star
27

sinatra-boilerplate

Sinatra + Haml Sass Compass Bourbon CoffeeScript
JavaScript
41
star
28

gh-contrib

GitHub CLI extension to render your contribution graph in the terminal
Shell
39
star
29

explain-ruby

Explains Ruby syntax
Ruby
32
star
30

twin

Twitter's twin; a Rack middleware to expose a Twitter-like API from your app
Ruby
30
star
31

gh-repo-collab

GitHub CLI extension to manage repository collaborators
Shell
28
star
32

user-scripts

User scripts for Greasemonkey/Safari/Fluid; home of Endless Tweets
JavaScript
28
star
33

standardista

A nicotine patch for Rails users who want to stop pretending they're writing XHTML
Ruby
23
star
34

tapas-bar

Tiny webapp that I use for watching RubyTapas from my iPad across home network.
Ruby
20
star
35

polyamory

A tool that knows how to run your tests regardless of framework
Ruby
19
star
36

remark

HTML to Markdown converter
Ruby
18
star
37

gh-delete-repo

[Deprecated] GitHub CLI extension for deleting GitHub repositories
Shell
17
star
38

rbenv-user-gems

[DEPRECATED] rbenv plugin for $GEM_HOME and user gems install location
Shell
15
star
39

go-travis

Go-based CLI tool for Travis CI
Go
15
star
40

shrubbery

Nested lists unlike you've ever seen
JavaScript
14
star
41

thor-tasks

GitHub tasks for Thor
14
star
42

gh-license

GitHub CLI extension to add a license to the current project
Shell
14
star
43

blog

The blog
HTML
14
star
44

itunes

Access iTunes with MacRuby through Scripting Bridge
C
13
star
45

facebook

Facebook login; DEPRECATED in favor of omniauth-facebook.
Ruby
13
star
46

textmate-bundles

My fork of a repo that once was "textmate/bundles"
11
star
47

curly

Easier than Curl::Easy
Ruby
10
star
48

async-upload

Example app for asynchronous file upload via hidden iframe with Prototype and PHP
PHP
9
star
49

rbenv-charles-ssl

rbenv plugin to help installing Charles Proxy SSL certificate into all rubies
Shell
9
star
50

cstags

ctags generator for CoffeeScript files
CoffeeScript
9
star
51

puppet-personal

I'm learning Puppet. WIP
Ruby
8
star
52

mingo

Ruby
8
star
53

asbestos

Render JSON from your XML Builder templates
Ruby
7
star
54

twitter-followers

Mini app that processes new followers notifications from Twitter
JavaScript
7
star
55

svg2png

Convert SVGs to PNG using headless Chrome
JavaScript
6
star
56

gh-repo-topic

[Deprecated] GitHub CLI extension to list or add repository topics
Shell
6
star
57

never-forget

The stupid exception tracker. Saves to MongoDB.
Ruby
6
star
58

Lyndon.tmbundle

Execute JavaScript expressions with a single keystroke inside TextMate
6
star
59

gh-lint-workflow

A GitHub CLI extension to lint GitHub Actions workflow files [EXPERIMENTAL]
Shell
6
star
60

railsgirls-movieapp

Example application for Rails Girls workshop
Ruby
5
star
61

stylish.vim

vim plugin to cycle through available color schemes and fonts on your system
Ruby
4
star
62

goreleaser-test

Shell
3
star
63

gh-notifications

Ruby
3
star
64

go-utils

Go
3
star
65

tweets

Grailbird site that powers an individual Twitter Archive, edited for my needs
JavaScript
3
star
66

gh-label

1
star
67

pages-cname-instructions

How to host GitHub Pages site on your own domain
JavaScript
1
star