Skip to content

Commit 4132074

Browse files
authored
Fix: Publish CLI WF release (#930)
* fix CLI WF * fix install command * auto prompt to add to path * workflow updates * rm edit to publish-binaries wf, add windows executable * update readme and install script fix * simpler version declaration when installing * synd-cli-v to be an internal tag * support for pre-releases
1 parent 3cfb1f1 commit 4132074

File tree

3 files changed

+93
-30
lines changed

3 files changed

+93
-30
lines changed

.github/workflows/publish-synd-cli.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Publish synd-cli Binaries
33
on:
44
workflow_dispatch:
55
inputs:
6-
tag_name:
7-
description: "synd-cli version tag (e.g., synd-cli-v1.0.0)"
6+
version:
7+
description: "Version (e.g., 1.0.0)"
88
required: true
99
type: string
1010

@@ -16,6 +16,13 @@ jobs:
1616
name: Build synd-cli executables
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Validate version format
20+
run: |
21+
if [[ ! "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
22+
echo "Error: version must be valid semver (e.g., 1.0.0, 1.0.0-beta.1)"
23+
exit 1
24+
fi
25+
1926
- uses: actions/checkout@v4
2027

2128
- name: Setup Bun
@@ -60,6 +67,14 @@ jobs:
6067
./src/cli/index.ts \
6168
--outfile synd-cli-darwin-arm64
6269
70+
- name: Build Windows x64
71+
run: |
72+
cd synd-cli
73+
bun build --compile --minify --sourcemap --bytecode \
74+
--target=bun-windows-x64 \
75+
./src/cli/index.ts \
76+
--outfile synd-cli-windows-x64.exe
77+
6378
- name: Upload build artifacts
6479
uses: actions/upload-artifact@v4
6580
with:
@@ -69,6 +84,7 @@ jobs:
6984
synd-cli/synd-cli-linux-arm64
7085
synd-cli/synd-cli-darwin-x64
7186
synd-cli/synd-cli-darwin-arm64
87+
synd-cli/synd-cli-windows-x64.exe
7288
retention-days: 1
7389

7490
publish-release:
@@ -78,7 +94,7 @@ jobs:
7894
needs: build
7995
runs-on: ubuntu-latest
8096
env:
81-
TAG_NAME: ${{ inputs.tag_name }}
97+
TAG_NAME: synd-cli-v${{ inputs.version }}
8298
steps:
8399
- name: Download build artifacts
84100
uses: actions/download-artifact@v4
@@ -87,22 +103,25 @@ jobs:
87103

88104
- name: Rename artifacts with version
89105
run: |
90-
mv synd-cli/synd-cli-linux-x64 synd-cli-linux-x64-${{ env.TAG_NAME }}
91-
mv synd-cli/synd-cli-linux-arm64 synd-cli-linux-arm64-${{ env.TAG_NAME }}
92-
mv synd-cli/synd-cli-darwin-x64 synd-cli-darwin-x64-${{ env.TAG_NAME }}
93-
mv synd-cli/synd-cli-darwin-arm64 synd-cli-darwin-arm64-${{ env.TAG_NAME }}
106+
mv synd-cli-linux-x64 synd-cli-linux-x64-${{ env.TAG_NAME }}
107+
mv synd-cli-linux-arm64 synd-cli-linux-arm64-${{ env.TAG_NAME }}
108+
mv synd-cli-darwin-x64 synd-cli-darwin-x64-${{ env.TAG_NAME }}
109+
mv synd-cli-darwin-arm64 synd-cli-darwin-arm64-${{ env.TAG_NAME }}
110+
mv synd-cli-windows-x64.exe synd-cli-windows-x64-${{ env.TAG_NAME }}.exe
94111
95112
- name: Create release and attach binaries
96113
uses: softprops/action-gh-release@v1
97114
with:
98115
tag_name: ${{ env.TAG_NAME }}
99116
name: "synd-cli ${{ env.TAG_NAME }}"
100117
body: "Release of synd-cli ${{ env.TAG_NAME }}"
118+
prerelease: ${{ contains(inputs.version, '-') }}
101119
files: |
102120
synd-cli-linux-x64-${{ env.TAG_NAME }}
103121
synd-cli-linux-arm64-${{ env.TAG_NAME }}
104122
synd-cli-darwin-x64-${{ env.TAG_NAME }}
105123
synd-cli-darwin-arm64-${{ env.TAG_NAME }}
124+
synd-cli-windows-x64-${{ env.TAG_NAME }}.exe
106125
107126
notify-failure:
108127
name: Notify on failure

synd-cli/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ A TypeScript-based CLI tool for creating and managing Syndicate Appchains. It ha
99
Install the latest version:
1010

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

1515
Install a specific version:
1616

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

2121
Custom install directory:
2222

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

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

114114
Each command supports:

synd-cli/install.sh

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
# Syndicate CLI Installer
55
# Usage:
66
# curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | bash
7-
# curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | SYND_VERSION=synd-cli-v1.0.0 bash
7+
# curl -L https://raw.githubusercontent.com/SyndicateProtocol/syndicate-appchains/main/synd-cli/install.sh | SYND_VERSION=1.0.0 bash
88

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

2727
error() {
28-
printf "${RED}error${NC}: %s\n" "$1"
28+
printf "${RED}error${NC}: %s\n" "$1" >&2
2929
exit 1
3030
}
3131

@@ -51,15 +51,16 @@ detect_platform() {
5151

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

6162
if [[ -z "$latest" ]]; then
62-
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"
63+
error "Failed to fetch latest synd-cli version. Please check your internet connection or specify a version with SYND_VERSION=X.Y.Z"
6364
fi
6465

6566
echo "$latest"
@@ -73,7 +74,7 @@ download_binary() {
7374

7475
tmp_file=$(mktemp)
7576

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

7879
if ! curl -fsSL "$url" -o "$tmp_file"; then
7980
rm -f "$tmp_file"
@@ -119,20 +120,60 @@ setup_path_instructions() {
119120
# Check if already in PATH
120121
if [[ ":$PATH:" == *":$INSTALL_DIR:"* ]]; then
121122
info "synd-cli is ready to use!"
123+
return
124+
fi
125+
126+
echo ""
127+
printf "${YELLOW}synd-cli is not in your PATH.${NC}\n"
128+
echo ""
129+
printf "Would you like to add it automatically? [Y/n] "
130+
131+
# Read user input (handle piped input by reading from /dev/tty)
132+
local response
133+
if [[ -t 0 ]]; then
134+
read -r response
122135
else
123-
echo ""
124-
warn "Add synd-cli to your PATH by running:"
125-
echo ""
126-
if [[ "$shell_name" == "fish" ]]; then
127-
printf " fish_add_path %s\n" "$INSTALL_DIR"
128-
else
129-
printf " echo 'export PATH=\"%s:\$PATH\"' >> %s\n" "$INSTALL_DIR" "$rc_file"
130-
fi
131-
echo ""
132-
printf "Then restart your shell or run:\n"
133-
printf " source %s\n" "$rc_file"
134-
echo ""
136+
read -r response < /dev/tty
135137
fi
138+
139+
case "$response" in
140+
[Yy]|"")
141+
# Add to PATH
142+
if [[ "$shell_name" == "fish" ]]; then
143+
echo "fish_add_path $INSTALL_DIR" >> "$rc_file"
144+
else
145+
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> "$rc_file"
146+
fi
147+
info "Added synd-cli to PATH in ${rc_file}"
148+
echo ""
149+
warn "Restart your terminal or run: source ${rc_file}"
150+
echo ""
151+
;;
152+
[Nn])
153+
echo ""
154+
printf "${YELLOW}========================================${NC}\n"
155+
warn "ACTION REQUIRED: Add synd-cli to your PATH"
156+
printf "${YELLOW}========================================${NC}\n"
157+
echo ""
158+
printf "Run this command to add synd-cli to your PATH:\n"
159+
echo ""
160+
if [[ "$shell_name" == "fish" ]]; then
161+
printf " ${GREEN}fish_add_path %s${NC}\n" "$INSTALL_DIR"
162+
else
163+
printf " ${GREEN}echo 'export PATH=\"%s:\$PATH\"' >> %s${NC}\n" "$INSTALL_DIR" "$rc_file"
164+
fi
165+
echo ""
166+
printf "Then restart your terminal or run:\n"
167+
echo ""
168+
printf " ${GREEN}source %s${NC}\n" "$rc_file"
169+
echo ""
170+
printf "${YELLOW}========================================${NC}\n"
171+
echo ""
172+
;;
173+
*)
174+
warn "Invalid response. Please manually add ${INSTALL_DIR} to your PATH."
175+
;;
176+
esac
136177
}
137178

138179
main() {
@@ -150,6 +191,9 @@ main() {
150191
if [[ -z "$version" ]]; then
151192
info "Fetching latest version..."
152193
version=$(get_latest_version)
194+
else
195+
# User provided version - add the synd-cli-v prefix
196+
version="synd-cli-v${version}"
153197
fi
154198
info "Version: ${version}"
155199

0 commit comments

Comments
 (0)