Skip to content

Commit 5f5e09a

Browse files
committed
Merge branch 'feature/homebrew-distribution' into development
2 parents f09802f + 9ef0126 commit 5f5e09a

3 files changed

Lines changed: 310 additions & 57 deletions

File tree

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
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+
# frozen_string_literal: true
173+
174+
# Homebrew formula for the smbCloud CLI (\`smb\` binary).
175+
class Cli < Formula
176+
desc 'smbCloud command line interface'
177+
homepage 'https://github.com/${REPO}'
178+
version '${VERSION}'
179+
license 'Apache-2.0'
180+
181+
on_macos do
182+
on_arm do
183+
url 'https://github.com/${REPO}/releases/download/${TAG}/smb-macos-arm64.tar.gz'
184+
sha256 '${ARM64_SHA}'
185+
end
186+
on_intel do
187+
url 'https://github.com/${REPO}/releases/download/${TAG}/smb-macos-amd64.tar.gz'
188+
sha256 '${AMD64_SHA}'
189+
end
190+
end
191+
192+
def install
193+
bin.install 'smb'
194+
end
195+
196+
test do
197+
system "#{bin}/smb", '--help'
198+
end
199+
end
200+
FORMULA
201+
202+
echo "Generated formula:"
203+
cat homebrew-tap/Formula/cli.rb
204+
205+
- name: Commit and push
206+
shell: bash
207+
run: |
208+
VERSION="${{ steps.release.outputs.version }}"
209+
210+
cd homebrew-tap
211+
git config user.name "github-actions[bot]"
212+
git config user.email "github-actions[bot]@users.noreply.github.com"
213+
git add Formula/cli.rb
214+
git diff --cached --quiet && echo "No changes" && exit 0
215+
git commit -m "Update smb to ${VERSION}"
216+
git push

README.MD

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,88 @@
55
<br>smbCloud CLI
66
</h1>
77
<p align="center">
8+
Deploy to the cloud in one command.
89
<br />
9-
<a href="#about">About</a>
10-
·
11-
<a href="#license">License</a>
10+
<br />
11+
<a href="https://www.smbcloud.xyz/">Website</a>
1212
·
1313
<a href="./docs">Documentation</a>
1414
·
1515
<a href="CONTRIBUTING.md">Contributing</a>
16+
·
17+
<a href="https://github.com/smbcloudXYZ/smbcloud-cli/releases">Releases</a>
18+
</p>
19+
<p align="center">
20+
<a href="https://crates.io/crates/smbcloud-cli"><img alt="crates.io" src="https://img.shields.io/crates/v/smbcloud-cli"></a>
21+
<a href="https://www.npmjs.com/package/@smbcloud/cli"><img alt="npm" src="https://img.shields.io/npm/v/@smbcloud/cli"></a>
22+
<a href="https://pypi.org/project/smbcloud-cli/"><img alt="PyPI" src="https://img.shields.io/pypi/v/smbcloud-cli"></a>
23+
<a href="https://github.com/smbcloudXYZ/smbcloud-cli/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/smbcloudXYZ/smbcloud-cli"></a>
1624
</p>
1725
</p>
1826

1927
## About
2028

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`.
29+
**`smb`** is the command-line interface for [smbCloud](https://www.smbcloud.xyz/) — the modern cloud deployment platform. Ship your Rust, Node.js, Ruby, or Swift app with a single command.
30+
31+
## Install
32+
33+
### Homebrew (macOS)
34+
35+
```sh
36+
brew tap smbcloudXYZ/homebrew-tap
37+
brew install cli
38+
```
39+
40+
### npm
41+
42+
```sh
43+
npm install -g @smbcloud/cli
44+
```
45+
46+
### pip
47+
48+
```sh
49+
pip install smbcloud-cli
50+
```
51+
52+
### Cargo
53+
54+
```sh
55+
cargo install smbcloud-cli
56+
```
57+
58+
### Shell (macOS / Linux)
59+
60+
```sh
61+
curl -fsSL https://raw.githubusercontent.com/smbcloudXYZ/smbcloud-cli/main/install-unix.sh | sh
62+
```
63+
64+
### PowerShell (Windows)
65+
66+
```powershell
67+
irm https://raw.githubusercontent.com/smbcloudXYZ/smbcloud-cli/main/install-windows.sh | iex
68+
```
69+
70+
Or grab a pre-built binary from the [Releases](https://github.com/smbcloudXYZ/smbcloud-cli/releases) page.
71+
72+
## Quick Start
73+
74+
```sh
75+
smb login
76+
smb init
77+
smb deploy
78+
```
79+
80+
That's it. Your app is live.
81+
82+
## Documentation
83+
84+
See the [`docs/`](./docs) directory for guides on authentication, project configuration, and deployment workflows.
85+
86+
## Contributing
2287

23-
> "Push-to-Deploy" or slide to unlock my heart. ~ Overheard in a metro, Slussen to Gamla Stan.
88+
Read [CONTRIBUTING.md](CONTRIBUTING.md) to get started. All contributions are welcome.
2489

2590
## License
2691

27-
MIT
92+
[Apache-2.0](LICENSE)

0 commit comments

Comments
 (0)