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

Commit

Permalink
set up brew and choco for iteration
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Townsend <brooks@cosmonic.com>

set up brew and choco for iteration

Signed-off-by: Brooks Townsend <brooks@cosmonic.com>
  • Loading branch information
brooksmtownsend committed Jun 13, 2023
1 parent b0104c5 commit 49fb8d9
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/release_brew.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
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

# TODO: Verify how to do this with one action
# - 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: 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
33 changes: 33 additions & 0 deletions .github/workflows/release_choco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release wash to chocolatey
on:
workflow_dispatch:
inputs:
dry_run:
description: "Build the release but don't push to chocolatey"
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
check:
runs-on: windows-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
- name: Build
run: choco pack
- name: Make sure it will install
run: choco install wash -y -dv -s .
16 changes: 16 additions & 0 deletions build/chocolatey/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

$ErrorActionPreference = 'Stop'; # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$url64 = 'https://github.com/wasmCloud/wash/releases/download/v0.17.3/wash.exe'

$packageArgs = @{
packageName = $env:ChocolateyPackageName
fileFullPath = "$toolsDir\wash.exe"
url64bit = $url64

checksum64 = '2A7E28D433B3067D0B1FE8CBA9D7B0B969A4360414EE423814CD8B311CC09C61'
checksumType64= 'sha256'
}

Get-ChocolateyWebFile @packageArgs
27 changes: 27 additions & 0 deletions build/chocolatey/wash.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>wash</id>

<version>0.17.3</version>

<title>wash</title>
<authors>wasmCloud Maintainers</authors>
<projectUrl>https://wasmcloud.com</projectUrl>
<iconUrl>https://wasmcloud.com/img/wasmcloud_icon.png</iconUrl>
<licenseUrl>https://github.com/wasmCloud/wash/blob/main/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/wasmcloud/wash</projectSourceUrl>
<packageSourceUrl>https://github.com/wasmCloud/chocolatey-wash</packageSourceUrl>
<docsUrl>https://wasmcloud.com</docsUrl>
<bugTrackerUrl>https://github.com/wasmCloud/wash/issues</bugTrackerUrl>
<tags>wash wasmCloud wasm</tags>
<summary>WAsmcloud SHell - the comprehensive command-line tool for wasmCloud development</summary>
<description>WAsmcloud SHell - the comprehensive command-line tool for wasmCloud development</description>
<releaseNotes>https://github.com/wasmCloud/wash/releases/tag/v0.17.3</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
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 49fb8d9

Please sign in to comment.