Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
initial addition of homebrew release
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Townsend <brooks@cosmonic.com>
  • Loading branch information
brooksmtownsend committed Jun 13, 2023
1 parent f23fb43 commit fb6e53b
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/release_brew.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release wash to homebrew
on:
workflow_dispatch:
inputs:
dry_run:
description: "Build the release but don't push to homebrew"
required: true
default: false
type: boolean
workflow_run:
workflows: [Release]
types: [completed]
jobs:
# Only runs if the regular release fails
failure_run:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- uses: actions/checkout@v3
- run: |
echo "Release workflow failed, not releasing to homebrew"
exit 1
release_homebrew:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
# Update the homebrew formula
- name: Update formula
env:
#TODO: verify this is the actual tag
WASH_VERSION: v0.17.4
# WASH_VERSION: ${{ github.ref_name }}
run: |
release_tarball_url="https://github.com/wasmCloud/wash/archive/$WASH_VERSION.tar.gz"
curl -fLO $release_tarball_url
washsha=$(shasum -a 256 $WASH_VERSION.tar.gz | cut -d ' ' -f 1)
release_tarball_sed="https:\/\/github.com\/wasmCloud\/wash\/archive\/$WASH_VERSION\.tar\.gz"
# Modify the formula using temporary files
cp ./build/homebrew/Formula/wash.rb ./formula1.rb
sed "/\ \ url\ /s/.*/\ \ url\ '$release_tarball_sed'/" formula1.rb > formula2.rb
sed "/\ \ sha256\ "/s/.*/\ \ sha256\ '$washsha'/" formula2.rb > formula3.rb
# Replace the single quotes with double quotes, replace formula
sed -i 's/"/\\"/g' formula3.rb > ./build/homebrew/Formula/wash.rb
#TODO: remove debug
echo ./build/homebrew/Formula/wash.rb
exit 1
# Test updates
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v1
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
- run: brew test-bot --only-cleanup-before
- run: brew test-bot --only-setup
- run: brew test-bot --only-tap-syntax
- run: brew test-bot --only-formulae
if: github.event_name == 'pull_request'

- name: Upload bottles as artifact
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@main
with:
name: bottles
path: "*.bottle.*"

# Prepare for release
- name: Set up git
uses: Homebrew/actions/git-user-config@master

- name: Pull bottles
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.actor }}
HOMEBREW_NO_INSTALL_FROM_API: 1
PULL_REQUEST: ${{ github.event.pull_request.number }}
run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST

- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ github.token }}
branch: main

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: Homebrew Release ${{ github.ref_name }}
body: This is the Homebrew release for ${{ github.ref_name }}. Please _rebase_ this PR and merge to `main`. If changes are required, please close this PR, make changes, and re-run the "Release homebrew and chocolatey" workflow.
branch: homebrew-release/${{ github.ref_name }}
signoff: true
Empty file.
27 changes: 27 additions & 0 deletions build/homebrew/Formula/wash.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Wash < Formula
desc "WAsmcloud SHell - a comprehensive command-line tool for wasmCloud development"
homepage "https://wasmcloud.com"
url "https://github.com/wasmCloud/wash/archive/v0.17.3.tar.gz"
sha256 "9a5404ef46a38fd531d4cf65569521317b90114e96348e43cf90ec63252214bd"
license "Apache-2.0"

bottle do
root_url "https://github.com/wasmCloud/homebrew-wasmcloud/releases/download/wash-0.17.2"
sha256 cellar: :any_skip_relocation, big_sur: "ed03b9e1edbe2fab73032dbb009cba8eddd3e7f769c7fcba8a58beb5ef638028"
sha256 cellar: :any_skip_relocation, x86_64_linux: "28a06a6f9c5464c15a0aaf055bb42d0d6f64de67b256b5aee7ebc3ed33ad9986"
end

depends_on "rust"

on_linux do
depends_on "zlib"
end

def install
system "cargo", "install", *std_cargo_args
end

test do
system "#{bin}/wash", "-V"
end
end
10 changes: 10 additions & 0 deletions build/homebrew/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# wash Homebrew tap

## Using

To use this tap to install wash:

```console
brew tap wasmcloud/wasmcloud
brew install wash
```

0 comments on commit fb6e53b

Please sign in to comment.