Skip to content
Merged
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
82 changes: 0 additions & 82 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,85 +96,3 @@ jobs:
dist/*.tar.gz \
dist/checksums.txt \
--clobber

homebrew-nssh:
# Skip prerelease tags so the tap formula keeps tracking the stable release.
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')
needs: release-create
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: nssh-*
merge-multiple: true
path: dist/
- name: Calculate checksums
id: checksums
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "darwin_amd64=$(sha256sum dist/nssh_${VERSION}_darwin_amd64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
echo "darwin_arm64=$(sha256sum dist/nssh_${VERSION}_darwin_arm64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
echo "linux_amd64=$(sha256sum dist/nssh_${VERSION}_linux_amd64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
echo "linux_arm64=$(sha256sum dist/nssh_${VERSION}_linux_arm64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
- name: Update homebrew tap
env:
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
VERSION=${{ steps.checksums.outputs.version }}

git clone https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/ntwrknrd/homebrew-nssh.git tap
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

mkdir -p Formula
cat > Formula/nssh.rb << 'EOF'
class Nssh < Formula
desc "SSH wrapper with credential management and session recording"
homepage "https://github.com/ntwrknrd/nssh"
license "GPL-3.0-only"
version "VERSION_PLACEHOLDER"

on_macos do
on_intel do
url "https://github.com/ntwrknrd/nssh/releases/download/vVERSION_PLACEHOLDER/nssh_VERSION_PLACEHOLDER_darwin_amd64.tar.gz"
sha256 "SHA_DARWIN_AMD64"
end
on_arm do
url "https://github.com/ntwrknrd/nssh/releases/download/vVERSION_PLACEHOLDER/nssh_VERSION_PLACEHOLDER_darwin_arm64.tar.gz"
sha256 "SHA_DARWIN_ARM64"
end
end

on_linux do
on_intel do
url "https://github.com/ntwrknrd/nssh/releases/download/vVERSION_PLACEHOLDER/nssh_VERSION_PLACEHOLDER_linux_amd64.tar.gz"
sha256 "SHA_LINUX_AMD64"
end
on_arm do
url "https://github.com/ntwrknrd/nssh/releases/download/vVERSION_PLACEHOLDER/nssh_VERSION_PLACEHOLDER_linux_arm64.tar.gz"
sha256 "SHA_LINUX_ARM64"
end
end

def install
bin.install "nssh", "nssh-askpass"
end

test do
system "#{bin}/nssh", "-V"
assert_predicate bin/"nssh-askpass", :executable?
end
end
EOF

sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" Formula/nssh.rb
sed -i "s/SHA_DARWIN_AMD64/${{ steps.checksums.outputs.darwin_amd64 }}/g" Formula/nssh.rb
sed -i "s/SHA_DARWIN_ARM64/${{ steps.checksums.outputs.darwin_arm64 }}/g" Formula/nssh.rb
sed -i "s/SHA_LINUX_AMD64/${{ steps.checksums.outputs.linux_amd64 }}/g" Formula/nssh.rb
sed -i "s/SHA_LINUX_ARM64/${{ steps.checksums.outputs.linux_arm64 }}/g" Formula/nssh.rb

git add Formula/nssh.rb
git commit -m "Update nssh to ${VERSION}"
git push
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![Build](https://github.com/ntwrknrd/nssh/actions/workflows/build.yml/badge.svg)](https://github.com/ntwrknrd/nssh/actions/workflows/build.yml)
[![Go Version](https://img.shields.io/github/go-mod/go-version/ntwrknrd/nssh)](go.mod)
[![Go Report Card](https://goreportcard.com/badge/github.com/ntwrknrd/nssh)](https://goreportcard.com/report/github.com/ntwrknrd/nssh)
[![Homebrew](https://img.shields.io/badge/homebrew-available-orange)](https://github.com/ntwrknrd/homebrew-nssh)
![Platforms](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-blue)

`nssh` is an SSH wrapper for operators who manage many hosts. It keeps host
Expand Down Expand Up @@ -73,13 +72,12 @@ finishes; commands cannot read interactive input. See the
```bash
curl -fsSL https://raw.githubusercontent.com/ntwrknrd/nssh/main/scripts/install.sh | sh

# or
brew install ntwrknrd/nssh/nssh

nssh self init
nssh self status
```

To update, run `nssh self reinstall`; it installs the latest GitHub release.

On first run, `nssh self init` creates the commented root config template and
offers credential and inventory provider setup. If `config.yaml` already exists,
bare init skips without changing it; use `nssh self reset` to start fresh. Add
Expand Down
3 changes: 1 addition & 2 deletions internal/cli/self/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ func FindBinary() string {
filepath.Join(home, ".local", "bin", "nssh"),
filepath.Join(home, "bin", "nssh"),
filepath.Join(home, "go", "bin", "nssh"),
"/opt/homebrew/bin/nssh", // Homebrew on Apple Silicon
"/usr/local/bin/nssh", // Homebrew on Intel Mac / manual install
"/usr/local/bin/nssh", // manual install
}

for _, loc := range locations {
Expand Down
Loading