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
33 changes: 26 additions & 7 deletions .github/workflows/publish-synd-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Publish synd-cli Binaries
on:
workflow_dispatch:
inputs:
tag_name:
description: "synd-cli version tag (e.g., synd-cli-v1.0.0)"
version:
description: "Version (e.g., 1.0.0)"
required: true
type: string

Expand All @@ -16,6 +16,13 @@ jobs:
name: Build synd-cli executables
runs-on: ubuntu-latest
steps:
- name: Validate version format
run: |
if [[ ! "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
echo "Error: version must be valid semver (e.g., 1.0.0, 1.0.0-beta.1)"
exit 1
fi

- uses: actions/checkout@v4

- name: Setup Bun
Expand Down Expand Up @@ -60,6 +67,14 @@ jobs:
./src/cli/index.ts \
--outfile synd-cli-darwin-arm64

- name: Build Windows x64
run: |
cd synd-cli
bun build --compile --minify --sourcemap --bytecode \
--target=bun-windows-x64 \
./src/cli/index.ts \
--outfile synd-cli-windows-x64.exe

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -69,6 +84,7 @@ jobs:
synd-cli/synd-cli-linux-arm64
synd-cli/synd-cli-darwin-x64
synd-cli/synd-cli-darwin-arm64
synd-cli/synd-cli-windows-x64.exe
retention-days: 1

publish-release:
Expand All @@ -78,7 +94,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
env:
TAG_NAME: ${{ inputs.tag_name }}
TAG_NAME: synd-cli-v${{ inputs.version }}
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
Expand All @@ -87,22 +103,25 @@ jobs:

- name: Rename artifacts with version
run: |
mv synd-cli/synd-cli-linux-x64 synd-cli-linux-x64-${{ env.TAG_NAME }}
mv synd-cli/synd-cli-linux-arm64 synd-cli-linux-arm64-${{ env.TAG_NAME }}
mv synd-cli/synd-cli-darwin-x64 synd-cli-darwin-x64-${{ env.TAG_NAME }}
mv synd-cli/synd-cli-darwin-arm64 synd-cli-darwin-arm64-${{ env.TAG_NAME }}
mv synd-cli-linux-x64 synd-cli-linux-x64-${{ env.TAG_NAME }}
mv synd-cli-linux-arm64 synd-cli-linux-arm64-${{ env.TAG_NAME }}
mv synd-cli-darwin-x64 synd-cli-darwin-x64-${{ env.TAG_NAME }}
mv synd-cli-darwin-arm64 synd-cli-darwin-arm64-${{ env.TAG_NAME }}
mv synd-cli-windows-x64.exe synd-cli-windows-x64-${{ env.TAG_NAME }}.exe

- name: Create release and attach binaries
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
name: "synd-cli ${{ env.TAG_NAME }}"
body: "Release of synd-cli ${{ env.TAG_NAME }}"
prerelease: ${{ contains(inputs.version, '-') }}
files: |
synd-cli-linux-x64-${{ env.TAG_NAME }}
synd-cli-linux-arm64-${{ env.TAG_NAME }}
synd-cli-darwin-x64-${{ env.TAG_NAME }}
synd-cli-darwin-arm64-${{ env.TAG_NAME }}
synd-cli-windows-x64-${{ env.TAG_NAME }}.exe

notify-failure:
name: Notify on failure
Expand Down
8 changes: 4 additions & 4 deletions synd-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ A TypeScript-based CLI tool for creating and managing Syndicate Appchains. It ha
Install the latest version:

```bash
curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | bash
curl -L https://cli.syndicate.io | bash
```

Install a specific version:

```bash
curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | SYND_VERSION=synd-cli-v1.0.0 bash
curl -L https://cli.syndicate.io | SYND_VERSION=synd-cli-v1.0.0 bash
```

Custom install directory:

```bash
curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | SYND_INSTALL_DIR=/usr/local/bin bash
curl -L https://cli.syndicate.io | SYND_INSTALL_DIR=/usr/local/bin bash
```

After installation, add `~/.synd/bin` to your PATH (the installer will provide instructions).
Expand Down Expand Up @@ -108,7 +108,7 @@ Run `synd-cli` to see all available commands. Main command categories:
- `appchain handoff` - Transfer contract ownership
- `appchain arb-owner` - Manage Arbitrum owner operations
- `appchain check-token-bridge` - Verify token bridge setup
- `appchain e2e` - Run end-to-end tests
- `appchain e2e` - Run end-to-end tests for an appchain
- `alias` - Calculate L1->L2 aliased addresses

Each command supports:
Expand Down
82 changes: 63 additions & 19 deletions synd-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail
# Syndicate CLI Installer
# Usage:
# curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | bash
# curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | SYND_VERSION=synd-cli-v1.0.0 bash
# curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | SYND_VERSION=1.0.0 bash

REPO="SyndicateProtocol/syndicate-appchains"
INSTALL_DIR="${SYND_INSTALL_DIR:-$HOME/.synd/bin}"
Expand All @@ -25,7 +25,7 @@ warn() {
}

error() {
printf "${RED}error${NC}: %s\n" "$1"
printf "${RED}error${NC}: %s\n" "$1" >&2
exit 1
}

Expand All @@ -51,15 +51,16 @@ detect_platform() {

get_latest_version() {
local latest
# Find the latest synd-cli release (tags starting with "synd-cli-")
# Find the latest stable synd-cli release (X.Y.Z without pre-release suffix)
# The "|| true" prevents pipefail from exiting the script when no version is found
latest=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases" | \
grep '"tag_name"' | \
sed -E 's/.*"([^"]+)".*/\1/' | \
grep '^synd-cli-' | \
head -n 1)
grep -E '^synd-cli-v[0-9]+\.[0-9]+\.[0-9]+$' | \
head -n 1 || true)

if [[ -z "$latest" ]]; then
error "Failed to fetch latest synd-cli version. Please check your internet connection or specify a version with SYND_VERSION=synd-cli-vX.Y.Z"
error "Failed to fetch latest synd-cli version. Please check your internet connection or specify a version with SYND_VERSION=X.Y.Z"
fi

echo "$latest"
Expand All @@ -73,7 +74,7 @@ download_binary() {

tmp_file=$(mktemp)

info "Downloading synd-cli ${version} for ${platform}..."
info "Downloading synd-cli ${version} for ${platform}..." >&2

if ! curl -fsSL "$url" -o "$tmp_file"; then
rm -f "$tmp_file"
Expand Down Expand Up @@ -119,20 +120,60 @@ setup_path_instructions() {
# Check if already in PATH
if [[ ":$PATH:" == *":$INSTALL_DIR:"* ]]; then
info "synd-cli is ready to use!"
return
fi

echo ""
printf "${YELLOW}synd-cli is not in your PATH.${NC}\n"
echo ""
printf "Would you like to add it automatically? [Y/n] "

# Read user input (handle piped input by reading from /dev/tty)
local response
if [[ -t 0 ]]; then
read -r response
else
echo ""
warn "Add synd-cli to your PATH by running:"
echo ""
if [[ "$shell_name" == "fish" ]]; then
printf " fish_add_path %s\n" "$INSTALL_DIR"
else
printf " echo 'export PATH=\"%s:\$PATH\"' >> %s\n" "$INSTALL_DIR" "$rc_file"
fi
echo ""
printf "Then restart your shell or run:\n"
printf " source %s\n" "$rc_file"
echo ""
read -r response < /dev/tty
fi

case "$response" in
[Yy]|"")
# Add to PATH
if [[ "$shell_name" == "fish" ]]; then
echo "fish_add_path $INSTALL_DIR" >> "$rc_file"
else
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> "$rc_file"
fi
info "Added synd-cli to PATH in ${rc_file}"
echo ""
warn "Restart your terminal or run: source ${rc_file}"
echo ""
;;
[Nn])
echo ""
printf "${YELLOW}========================================${NC}\n"
warn "ACTION REQUIRED: Add synd-cli to your PATH"
printf "${YELLOW}========================================${NC}\n"
echo ""
printf "Run this command to add synd-cli to your PATH:\n"
echo ""
if [[ "$shell_name" == "fish" ]]; then
printf " ${GREEN}fish_add_path %s${NC}\n" "$INSTALL_DIR"
else
printf " ${GREEN}echo 'export PATH=\"%s:\$PATH\"' >> %s${NC}\n" "$INSTALL_DIR" "$rc_file"
fi
echo ""
printf "Then restart your terminal or run:\n"
echo ""
printf " ${GREEN}source %s${NC}\n" "$rc_file"
echo ""
printf "${YELLOW}========================================${NC}\n"
echo ""
;;
*)
warn "Invalid response. Please manually add ${INSTALL_DIR} to your PATH."
;;
esac
}

main() {
Expand All @@ -150,6 +191,9 @@ main() {
if [[ -z "$version" ]]; then
info "Fetching latest version..."
version=$(get_latest_version)
else
# User provided version - add the synd-cli-v prefix
version="synd-cli-v${version}"
fi
info "Version: ${version}"

Expand Down
Loading