Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

xsc/homebrew-import-release-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

homebrew-import-release-action

CI Release

This is a Github Action to populate a Homebrew tap with formulas based on Github releases and their assets.

Usage

- uses: xsc/homebrew-import-release-action@v2
  id: formula
  with:
    template: into-docker.template.rb
    target: into-docker.rb
    repository: into-docker/into-docker
    asset-selector: macos-amd64.zip

Afterwards, you can use e.g. create-pull-request to allow for a review of the changes:

- uses: peter-evans/create-pull-request@v3
  with:
    title: "Update 'into-docker' formula (${{ steps.formula.outputs.version }})"
    commit-message: "Formula: into-docker@${{ steps.formula.outputs.version }}"
    branch: "update-formula/into-docker-${{ steps.formula.outputs.version }}"

(I suspect you should not commit these directly.)

Prerequisites

  • Existing Github release with corresponding tag (e.g. v1.0.0).
  • An asset attached to the release that matches a defined selector (see below).
  • A template file that can use the following variables for substitution:
    • HOMEBREW_VERSION: version of the formula.
    • HOMEBREW_ASSET_URL: URL to the matched release asset.
    • HOMEBREW_SHA256: SHA-256 hash of the matched release asset.
    • HOMEBREW_ASSET_URL_ALT: URL to the alternative release asset (e.g. Linux version).
    • HOMEBREW_SHA256_ALT: SHA-256 hash of the alternative release asset (e.g. Linux version).

Inputs

Name Required Description
template Yes Local path to the template file.
target Yes Local path to the output file.
repository Yes Repository to query for releases.
asset-selector Yes Substring that is contained within the main asset's filename.
alt-asset-selector No Substring that is contained within the alternative asset's filename.
tag No Specific release tag to use for creating the formula (defaults to latest release).
version No Override the formula version (defaults to using the tag minus a v prefix)

Outputs

Name Description
target Path to the output file (echoed).
version Version of the formula (useful if inferred from the release).
releaseUrl URL pointing at the Github release.

Development

We use prettier to ensure consistent formatting of Markdown and YAML files. Please run yarn or npm install to register the pre-commit hook.

License

MIT License

Copyright (c) 2021 Yannick Scherer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Github Action to create a Homebrew formula from a Github release

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •