Skip to content

Commit b838e37

Browse files
committed
chore: add powershell and homebrew installers
1 parent fbf4cdc commit b838e37

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,56 @@ jobs:
235235
name: artifacts-dist-manifest
236236
path: dist-manifest.json
237237

238+
publish-homebrew-formula:
239+
needs:
240+
- plan
241+
- host
242+
runs-on: "ubuntu-20.04"
243+
env:
244+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
245+
PLAN: ${{ needs.plan.outputs.val }}
246+
GITHUB_USER: "axo bot"
247+
GITHUB_EMAIL: "[email protected]"
248+
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
249+
steps:
250+
- uses: actions/checkout@v4
251+
with:
252+
repository: "marcfrederick/homebrew-tap"
253+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
254+
# So we have access to the formula
255+
- name: Fetch homebrew formulae
256+
uses: actions/download-artifact@v4
257+
with:
258+
pattern: artifacts-*
259+
path: Formula/
260+
merge-multiple: true
261+
# This is extra complex because you can make your Formula name not match your app name
262+
# so we need to find releases with a *.rb file, and publish with that filename.
263+
- name: Commit formula files
264+
run: |
265+
git config --global user.name "${GITHUB_USER}"
266+
git config --global user.email "${GITHUB_EMAIL}"
267+
268+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
269+
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
270+
name=$(echo "$filename" | sed "s/\.rb$//")
271+
version=$(echo "$release" | jq .app_version --raw-output)
272+
273+
git add "Formula/${filename}"
274+
git commit -m "${name} ${version}"
275+
done
276+
git push
277+
238278
# Create a GitHub Release while uploading all files to it
239279
announce:
240280
needs:
241281
- plan
242282
- host
283+
- publish-homebrew-formula
243284
# use "always() && ..." to allow us to wait for all publish jobs while
244285
# still allowing individual publish jobs to skip themselves (for prereleases).
245286
# "host" however must run to completion, no skipping allowed!
246-
if: ${{ always() && needs.host.result == 'success' }}
287+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }}
247288
runs-on: "ubuntu-20.04"
248289
env:
249290
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[package]
22
name = "git-foreach"
33
description = "Run a command in each git repository in a directory"
4-
version = "0.1.0"
4+
version = "0.1.1"
55
edition = "2021"
6+
license = "MIT"
7+
homepage = "https://github.com/marcfrederick/git-foreach"
68
repository = "https://github.com/marcfrederick/git-foreach"
79

810
[profile.dist]
@@ -19,4 +21,6 @@ ci = "github"
1921
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
2022
pr-run-mode = "plan"
2123
install-updater = false
22-
installers = ["shell"]
24+
installers = ["shell", "powershell", "homebrew"]
25+
tap = "marcfrederick/homebrew-tap"
26+
publish-jobs = ["homebrew"]

0 commit comments

Comments
 (0)