Skip to content

Commit 27c6adc

Browse files
feat (wip): add brew tap for oasis-cli
1 parent dc6ac7e commit 27c6adc

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.github/workflows/brew.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Brew audit & test
2+
on: [push, pull_request]
3+
4+
jobs:
5+
audit:
6+
strategy:
7+
matrix:
8+
os: [macos-latest, ubuntu-latest]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: Homebrew/actions/setup-homebrew@master
13+
- name: Audit
14+
run: brew audit --strict --online --formula Formula/oasis.rb
15+
- name: Build & test
16+
run: |
17+
brew install --build-from-source Formula/oasis.rb
18+
oasis --version

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,22 @@ jobs:
3434
make release-build
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Bump Homebrew formula
38+
if: startsWith(github.ref, 'refs/tags/')
39+
env:
40+
TAG: ${{ github.ref_name }} # e.g. v0.4.5
41+
run: |
42+
FORMULA=Formula/oasis.rb
43+
URL="https://github.com/oasisprotocol/cli/archive/refs/tags/${TAG}.tar.gz"
44+
SHA256=$(curl -Ls $URL | shasum -a 256 | cut -d" " -f1)
45+
46+
sed -i.bak -E "s/^ version \".*\"/ version \"${TAG#v}\"/" $FORMULA
47+
sed -i.bak -E "s|^ url \".*\"| url \"${URL}\"|" $FORMULA
48+
sed -i.bak -E "s/^ sha256 \".*\"/ sha256 \"${SHA256}\"/" $FORMULA
49+
rm $FORMULA.bak
50+
51+
git config user.name "github-actions[bot]"
52+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
53+
git add $FORMULA
54+
git commit -m "brew(oasis): bump to ${TAG}"
55+
git push

Formula/oasis.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# typed: false
2+
# frozen_string_literal: true
3+
4+
class Oasis < Formula
5+
desc "CLI for interacting with the Oasis network"
6+
homepage "https://github.com/oasisprotocol/cli"
7+
license "Apache-2.0"
8+
version "0.0.0" # ──► Automatically bumped on every tag by CI
9+
10+
# Source tarball for the tagged release
11+
url "https://github.com/oasisprotocol/cli/archive/refs/tags/v#{version}.tar.gz"
12+
sha256 "<SHA256_FROM_CI>" # ──► Replaced by release workflow
13+
14+
depends_on "go" => :build
15+
16+
livecheck do
17+
url :stable
18+
regex(/^v?(\d+\.\d+\.\d+)$/i)
19+
end
20+
21+
def install
22+
ldflags = %W[
23+
-s -w
24+
-X github.com/oasisprotocol/cli/version.Software=#{version}
25+
].join(" ")
26+
system "go", "build", *std_go_args(ldflags: ldflags), "./"
27+
end
28+
29+
test do
30+
assert_match version.to_s, shell_output("#{bin}/oasis --version")
31+
end
32+
end

0 commit comments

Comments
 (0)