Skip to content

Commit

Permalink
chore: add powershell and homebrew installers
Browse files Browse the repository at this point in the history
  • Loading branch information
marcfrederick committed Jun 4, 2024
1 parent fbf4cdc commit b838e37
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
43 changes: 42 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,56 @@ jobs:
name: artifacts-dist-manifest
path: dist-manifest.json

publish-homebrew-formula:
needs:
- plan
- host
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLAN: ${{ needs.plan.outputs.val }}
GITHUB_USER: "axo bot"
GITHUB_EMAIL: "[email protected]"
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
steps:
- uses: actions/checkout@v4
with:
repository: "marcfrederick/homebrew-tap"
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
# So we have access to the formula
- name: Fetch homebrew formulae
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
# Create a GitHub Release while uploading all files to it
announce:
needs:
- plan
- host
- publish-homebrew-formula
# use "always() && ..." to allow us to wait for all publish jobs while
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' }}
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }}
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[package]
name = "git-foreach"
description = "Run a command in each git repository in a directory"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "MIT"
homepage = "https://github.com/marcfrederick/git-foreach"
repository = "https://github.com/marcfrederick/git-foreach"

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

0 comments on commit b838e37

Please sign in to comment.