Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ jobs:

### Install

**Homebrew (recommended)**
```bash
brew tap fourninecs/cloud-tunnels https://github.com/FournineCS/cloud-tunnels
brew install --cask cloudtunnels # GUI app
brew install ctun # CLI
```

**Manual**
```bash
unzip CloudTunnels.zip -d /Applications/
open /Applications/CloudTunnels.app
Expand All @@ -252,3 +260,64 @@ jobs:
build/CloudTunnels-x86_64.zip
build/ctun-universal.tar.gz
build/SHA256SUMS.txt

update-formulas:
name: Update Homebrew formulas
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}

- name: Determine version
id: ver
env:
INPUT_TAG: ${{ github.event.inputs.tag }}
REF_NAME: ${{ github.ref_name }}
run: |
TAG="${INPUT_TAG:-$REF_NAME}"
VERSION="${TAG#v}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

- name: Fetch SHA256SUMS
run: |
curl -fsSL \
"https://github.com/FournineCS/cloud-tunnels/releases/download/${{ steps.ver.outputs.tag }}/SHA256SUMS.txt" \
-o SHA256SUMS.txt
cat SHA256SUMS.txt

- name: Parse checksums
id: shas
run: |
APP_SHA=$(grep 'CloudTunnels\.zip' SHA256SUMS.txt | awk '{print $1}')
CTUN_SHA=$(grep 'ctun-universal\.tar\.gz' SHA256SUMS.txt | awk '{print $1}')
echo "app_sha=${APP_SHA}" >> "$GITHUB_OUTPUT"
echo "ctun_sha=${CTUN_SHA}" >> "$GITHUB_OUTPUT"

- name: Update Casks/cloudtunnels.rb
run: |
V="${{ steps.ver.outputs.version }}"
S="${{ steps.shas.outputs.app_sha }}"
sed -i "s|version \"[^\"]*\"|version \"${V}\"|" Casks/cloudtunnels.rb
sed -i "s|sha256 \"[a-f0-9]*\"|sha256 \"${S}\"|" Casks/cloudtunnels.rb

- name: Update Formula/ctun.rb
run: |
V="${{ steps.ver.outputs.version }}"
S="${{ steps.shas.outputs.ctun_sha }}"
sed -i "s|releases/download/v[^/]*/ctun|releases/download/v${V}/ctun|" Formula/ctun.rb
sed -i "s|sha256 \"[a-f0-9]*\"|sha256 \"${S}\"|" Formula/ctun.rb
sed -i "s|version \"[^\"]*\"|version \"${V}\"|" Formula/ctun.rb

- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/cloudtunnels.rb Formula/ctun.rb
git diff --cached --quiet && echo "No formula changes." && exit 0
git commit -m "chore(homebrew): bump to ${{ steps.ver.outputs.tag }}"
git push
19 changes: 19 additions & 0 deletions Casks/cloudtunnels.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cask "cloudtunnels" do
version "1.0.2"
sha256 "eb715a188760add3c229137a85962527bffb306fdfa8972bdb387273294fbd6d"

url "https://github.com/FournineCS/cloud-tunnels/releases/download/v#{version}/CloudTunnels.zip"
name "CloudTunnels"
desc "Native macOS menu bar app for managing GCP IAP, AWS SSM, Cloud SQL Proxy, and SSH tunnels"
homepage "https://github.com/FournineCS/cloud-tunnels"

depends_on macos: ">= :ventura"

app "CloudTunnels.app"

zap trash: [
"~/Library/Application Support/CloudTunnels",
"~/Library/Preferences/com.fourninecloud.cloud-tunnels.plist",
"~/Library/Logs/CloudTunnels",
]
end
18 changes: 18 additions & 0 deletions Formula/ctun.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Ctun < Formula
desc "CLI for managing GCP IAP, AWS SSM, Cloud SQL Proxy, and SSH port-forwarding tunnels"
homepage "https://github.com/FournineCS/cloud-tunnels"
url "https://github.com/FournineCS/cloud-tunnels/releases/download/v1.0.2/ctun-universal.tar.gz"
sha256 "9a35a0a1621f05b6ec4fc305d78ff0da26e7466a5be2129d9441c4c1216aaafb"
version "1.0.2"
license "MIT"

depends_on :macos

def install
bin.install "ctun"
end

test do
assert_match version.to_s, shell_output("#{bin}/ctun --version 2>&1")
end
end
Loading