-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add contrib action "Homebrew/actions/setup-homebrew" at version…
… master#83bed10
- Loading branch information
1 parent
2773cdb
commit 0fac3b8
Showing
7 changed files
with
445 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Setup Homebrew Github Action | ||
|
||
An action that sets up a Homebrew environment. | ||
|
||
Runs on `ubuntu` and `macos`. | ||
|
||
## Usage | ||
|
||
```yaml | ||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
``` | ||
This also sets up the variables necessary to cache the gems installed by Homebrew developer commands (e.g. `brew style`). To use these add: | ||
|
||
```yaml | ||
- name: Cache Homebrew Bundler RubyGems | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.set-up-homebrew.outputs.gems-path }} | ||
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} | ||
restore-keys: ${{ runner.os }}-rubygems- | ||
- name: Install Homebrew Bundler RubyGems | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: brew install-bundler-gems | ||
``` | ||
|
||
Note you do not need to use the `actions/setup-ruby` or `actions/checkout` steps because this action will install the necessary Ruby for Homebrew and checkout the repository being tested. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Setup Homebrew | ||
description: Set up Homebrew environment | ||
author: dawidd6 | ||
branding: | ||
icon: settings | ||
color: yellow | ||
inputs: | ||
core: | ||
description: Update the `homebrew/core` tap. | ||
required: false | ||
default: false | ||
cask: | ||
description: Update the `homebrew/cask` tap. | ||
required: false | ||
default: false | ||
test-bot: | ||
description: Install the `homebrew/test-bot` tap. | ||
required: false | ||
default: auto | ||
debug: | ||
description: Show debugging output | ||
required: false | ||
default: ${{ runner.debug == '1' }} | ||
token: | ||
description: Token to be used for GitHub authentication (if using private repositories). This token will persist through other steps for the duration of the job. | ||
required: false | ||
default: "" | ||
brew-gh-api-token: | ||
description: Token to be used for GitHub API operations within `brew`. This is confusingly not the same thing as `token` above. | ||
required: false | ||
default: "${{ github.token }}" | ||
stable: | ||
description: Use the latest stable `homebrew/brew` tag. | ||
required: false | ||
default: false | ||
outputs: | ||
repository-path: | ||
description: Path to where the repository has been checked out (if applicable) | ||
gems-path: | ||
description: Homebrew's Ruby gems path | ||
gems-hash: | ||
description: Homebrew's Ruby Gemfile.lock sha256sum | ||
runs: | ||
using: node20 | ||
main: main.mjs | ||
post: post.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { exec } from "@actions/exec" | ||
import core from "@actions/core" | ||
|
||
// GitHub Actions does not support shell `post` actions and thus requires a JS wrapper. | ||
try { | ||
await exec("/bin/bash", [ | ||
new URL("./main.sh", import.meta.url).pathname, | ||
core.getInput("core"), | ||
core.getInput("cask"), | ||
core.getInput("test-bot"), | ||
core.getInput("debug"), | ||
core.getInput("token"), | ||
core.getInput("stable"), | ||
core.getInput("brew-gh-api-token"), | ||
]) | ||
} catch (error) { | ||
core.setFailed(error.message) | ||
} |
Oops, something went wrong.