@smbcloud / cli / commits / afa908d

Add GitHub Actions workflow for Homebrew release automation

Remove whimsical quote from README

Seto Elkahfi committed Apr 3, 2026 at 14:01 UTC afa908de7066060047603e6db22f64ccb8f88316
2 files changed +214 -2
.github/workflows/release-homebrew.yml new
+214
@@ -0,0 +1,214 @@
1 +name: Homebrew Release
2 +
3 +on:
4 + release:
5 + types: [published]
6 + workflow_dispatch:
7 + inputs:
8 + tag:
9 + description: "Release tag (e.g. v0.3.34)"
10 + required: true
11 +
12 +permissions:
13 + contents: write
14 +
15 +env:
16 + PROJECT_NAME: smb
17 + CARGO_TERM_COLOR: always
18 +
19 +jobs:
20 + build-macos:
21 + name: Build macOS (${{ matrix.arch }})
22 + runs-on: ${{ matrix.runner }}
23 +
24 + strategy:
25 + fail-fast: false
26 + matrix:
27 + include:
28 + - arch: arm64
29 + runner: macos-latest
30 + target: aarch64-apple-darwin
31 + - arch: amd64
32 + runner: macos-15-intel
33 + target: x86_64-apple-darwin
34 +
35 + steps:
36 + - name: Resolve release tag
37 + id: tag
38 + shell: bash
39 + run: |
40 + if [[ "${{ github.event_name }}" == "release" ]]; then
41 + TAG="${{ github.event.release.tag_name }}"
42 + else
43 + TAG="${{ github.event.inputs.tag }}"
44 + fi
45 + echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
46 +
47 + - name: Checkout
48 + uses: actions/checkout@v4
49 + with:
50 + ref: ${{ steps.tag.outputs.tag }}
51 +
52 + - name: Read Rust toolchain
53 + shell: bash
54 + run: |
55 + rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)"
56 + if [ -z "$rust_toolchain" ]; then
57 + echo "Failed to read Rust toolchain from rust-toolchain.toml" >&2
58 + exit 1
59 + fi
60 + echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV"
61 +
62 + - name: Install Rust toolchain
63 + uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
64 + with:
65 + toolchain: ${{ env.RUST_TOOLCHAIN }}
66 +
67 + - name: Add Rust target
68 + shell: bash
69 + run: |
70 + rustup target add ${{ matrix.target }} --toolchain ${{ env.RUST_TOOLCHAIN }}
71 +
72 + - name: Setup Rust cache
73 + uses: Swatinem/rust-cache@v2
74 + with:
75 + key: homebrew-${{ matrix.target }}
76 +
77 + - name: Create .env file
78 + run: |
79 + echo "CLI_CLIENT_SECRET=${{ secrets.CLI_CLIENT_SECRET }}" > .env
80 +
81 + - name: Build
82 + shell: bash
83 + run: |
84 + cargo build --release --locked --target ${{ matrix.target }}
85 +
86 + - name: Package tarball
87 + shell: bash
88 + run: |
89 + ARCHIVE_NAME="smb-macos-${{ matrix.arch }}.tar.gz"
90 +
91 + mkdir -p staging
92 + cp "target/${{ matrix.target }}/release/smb" staging/
93 +
94 + tar -C staging -czf "${ARCHIVE_NAME}" smb
95 +
96 + shasum -a 256 "${ARCHIVE_NAME}" | awk '{print $1}' > "${ARCHIVE_NAME}.sha256"
97 +
98 + echo "Archive: ${ARCHIVE_NAME}"
99 + echo "SHA256: $(cat "${ARCHIVE_NAME}.sha256")"
100 +
101 + - name: Upload artifact
102 + uses: actions/upload-artifact@v4
103 + with:
104 + name: smb-macos-${{ matrix.arch }}
105 + path: |
106 + smb-macos-${{ matrix.arch }}.tar.gz
107 + smb-macos-${{ matrix.arch }}.tar.gz.sha256
108 +
109 + - name: Attach to GitHub Release
110 + uses: softprops/action-gh-release@v2
111 + with:
112 + tag_name: ${{ steps.tag.outputs.tag }}
113 + files: smb-macos-${{ matrix.arch }}.tar.gz
114 +
115 + update-homebrew-tap:
116 + name: Update Homebrew tap
117 + needs: build-macos
118 + runs-on: ubuntu-latest
119 +
120 + steps:
121 + - name: Resolve tag and version
122 + id: release
123 + shell: bash
124 + run: |
125 + if [[ "${{ github.event_name }}" == "release" ]]; then
126 + TAG="${{ github.event.release.tag_name }}"
127 + else
128 + TAG="${{ github.event.inputs.tag }}"
129 + fi
130 + VERSION="${TAG#v}"
131 +
132 + echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
133 + echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
134 +
135 + - name: Download artifacts
136 + uses: actions/download-artifact@v4
137 + with:
138 + path: artifacts/
139 +
140 + - name: Read SHA256 checksums
141 + id: sha
142 + shell: bash
143 + run: |
144 + ARM64_SHA=$(cat artifacts/smb-macos-arm64/smb-macos-arm64.tar.gz.sha256)
145 + AMD64_SHA=$(cat artifacts/smb-macos-amd64/smb-macos-amd64.tar.gz.sha256)
146 +
147 + echo "arm64=${ARM64_SHA}" >> "$GITHUB_OUTPUT"
148 + echo "amd64=${AMD64_SHA}" >> "$GITHUB_OUTPUT"
149 +
150 + echo "ARM64 SHA256: ${ARM64_SHA}"
151 + echo "AMD64 SHA256: ${AMD64_SHA}"
152 +
153 + - name: Checkout Homebrew tap
154 + uses: actions/checkout@v4
155 + with:
156 + repository: smbcloudXYZ/homebrew-tap
157 + token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
158 + path: homebrew-tap
159 +
160 + - name: Generate formula
161 + shell: bash
162 + run: |
163 + VERSION="${{ steps.release.outputs.version }}"
164 + TAG="${{ steps.release.outputs.tag }}"
165 + ARM64_SHA="${{ steps.sha.outputs.arm64 }}"
166 + AMD64_SHA="${{ steps.sha.outputs.amd64 }}"
167 + REPO="smbcloudXYZ/smbcloud-cli"
168 +
169 + mkdir -p homebrew-tap/Formula
170 +
171 + cat > homebrew-tap/Formula/cli.rb <<FORMULA
172 + # Homebrew formula for the smbCloud CLI (\`smb\` binary).
173 + class Cli < Formula
174 + desc "smbCloud command line interface"
175 + homepage "https://github.com/${REPO}"
176 + version "${VERSION}"
177 + license "Apache-2.0"
178 +
179 + on_macos do
180 + on_arm do
181 + url "https://github.com/${REPO}/releases/download/${TAG}/smb-macos-arm64.tar.gz"
182 + sha256 "${ARM64_SHA}"
183 + end
184 + on_intel do
185 + url "https://github.com/${REPO}/releases/download/${TAG}/smb-macos-amd64.tar.gz"
186 + sha256 "${AMD64_SHA}"
187 + end
188 + end
189 +
190 + def install
191 + bin.install "smb"
192 + end
193 +
194 + test do
195 + system "#{bin}/smb", "--help"
196 + end
197 + end
198 + FORMULA
199 +
200 + echo "Generated formula:"
201 + cat homebrew-tap/Formula/cli.rb
202 +
203 + - name: Commit and push
204 + shell: bash
205 + run: |
206 + VERSION="${{ steps.release.outputs.version }}"
207 +
208 + cd homebrew-tap
209 + git config user.name "github-actions[bot]"
210 + git config user.email "github-actions[bot]@users.noreply.github.com"
211 + git add Formula/cli.rb
212 + git diff --cached --quiet && echo "No changes" && exit 0
213 + git commit -m "Update smb to ${VERSION}"
214 + git push
README.MD
-2
@@ -20,8 +20,6 @@
20
21 **smbcloud-cli** is a robust, open-source command-line interface (CLI) for [smbcloud](https://smbcloud.xyz/)—the modern cloud deployment platform. Deploy your Rust, NodeJs, Ruby, or Swift apps with one command: `smb`.
22
23 -> "Push-to-Deploy" or slide to unlock my heart. ~ Overheard in a metro, Slussen to Gamla Stan.
24 -
23 ## License
24
25 MIT