Skip to content

Commit 75e2be3

Browse files
feat: Command Line SDK update for version 18.0.0 (#296)
* chore: update Command Line SDK to 18.0.0 * chore: update Command Line SDK to 18.0.0 * fix: regenerate bun.lock for updated console SDK dependency --------- Co-authored-by: Chirag Aggarwal <chiragaggarwal@gmail.com>
1 parent d299e89 commit 75e2be3

67 files changed

Lines changed: 2653 additions & 1141 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ on:
66

77
permissions:
88
id-token: write
9-
contents: read
9+
contents: write
1010

1111
jobs:
1212
build-and-publish:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.GH_TOKEN }}
1618
- uses: oven-sh/setup-bun@v2
1719
with:
1820
bun-version: latest
@@ -66,3 +68,71 @@ jobs:
6668
GHR_PATH: build/
6769
GHR_REPLACE: false
6870
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
71+
72+
- name: Update Homebrew formula checksums
73+
env:
74+
RELEASE_TAG: ${{ github.event.release.tag_name }}
75+
TARGET_COMMITISH: ${{ github.event.release.target_commitish }}
76+
run: |
77+
set -euo pipefail
78+
79+
TARGET_BRANCH="$TARGET_COMMITISH"
80+
if ! git ls-remote --exit-code --heads origin "$TARGET_BRANCH" >/dev/null 2>&1; then
81+
TARGET_BRANCH="master"
82+
fi
83+
84+
git fetch origin "$TARGET_BRANCH"
85+
git switch -C "$TARGET_BRANCH" "origin/$TARGET_BRANCH"
86+
87+
FORMULA_PATH="$(find Formula -maxdepth 1 -name '*.rb' | head -n 1)"
88+
if [ -z "$FORMULA_PATH" ]; then
89+
echo "Formula file not found"
90+
exit 1
91+
fi
92+
93+
EXECUTABLE_NAME="$(basename "$FORMULA_PATH" .rb)"
94+
export FORMULA_PATH RELEASE_TAG EXECUTABLE_NAME
95+
export MAC_ARM64_SHA256="$(sha256sum "build/${EXECUTABLE_NAME}-cli-darwin-arm64" | awk '{print $1}')"
96+
export MAC_X64_SHA256="$(sha256sum "build/${EXECUTABLE_NAME}-cli-darwin-x64" | awk '{print $1}')"
97+
export LINUX_ARM64_SHA256="$(sha256sum "build/${EXECUTABLE_NAME}-cli-linux-arm64" | awk '{print $1}')"
98+
export LINUX_X64_SHA256="$(sha256sum "build/${EXECUTABLE_NAME}-cli-linux-x64" | awk '{print $1}')"
99+
100+
ruby <<'RUBY'
101+
formula_path = ENV.fetch("FORMULA_PATH")
102+
executable = ENV.fetch("EXECUTABLE_NAME")
103+
release_tag = ENV.fetch("RELEASE_TAG")
104+
checksums = {
105+
"#{executable}-cli-darwin-arm64" => ENV.fetch("MAC_ARM64_SHA256"),
106+
"#{executable}-cli-darwin-x64" => ENV.fetch("MAC_X64_SHA256"),
107+
"#{executable}-cli-linux-arm64" => ENV.fetch("LINUX_ARM64_SHA256"),
108+
"#{executable}-cli-linux-x64" => ENV.fetch("LINUX_X64_SHA256"),
109+
}
110+
111+
text = File.read(formula_path)
112+
113+
unless text.sub!(/^(\s*version ")([^"]+)(")$/) { "#{$1}#{release_tag}#{$3}" }
114+
abort("Failed to update formula version")
115+
end
116+
117+
checksums.each do |artifact, checksum|
118+
pattern = /(\Q#{artifact}\E"\n\s+sha256 ")([0-9a-f]{64})(")/
119+
unless text.sub!(pattern) { "#{$1}#{checksum}#{$3}" }
120+
abort("Failed to update checksum for #{artifact}")
121+
end
122+
end
123+
124+
File.write(formula_path, text)
125+
RUBY
126+
127+
ruby -c "$FORMULA_PATH"
128+
129+
if git diff --quiet -- "$FORMULA_PATH"; then
130+
echo "Homebrew formula already up to date"
131+
exit 0
132+
fi
133+
134+
git config user.name "github-actions[bot]"
135+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
136+
git add "$FORMULA_PATH"
137+
git commit -m "chore: update Homebrew formula for ${RELEASE_TAG}"
138+
git push origin "$TARGET_BRANCH"

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Change Log
22

3+
## 18.0.0
4+
5+
* Breaking: Moved `keys` commands from `projects` to `project` service. They no longer require `--project-id`, but `create-key` now requires `--key-id`
6+
* Breaking: Moved `update-labels` from `projects` to `project` service
7+
* Breaking: Moved platform commands from `projects` to `project` service and split generic `create-platform`/`update-platform` into platform-specific commands: `create-android-platform`, `create-apple-platform`, `create-linux-platform`, `create-web-platform`, `create-windows-platform` (and corresponding update variants). New methods no longer require `--project-id`, but require `--platform-id`, and `key` parameter was renamed to platform-specific terminology, such as `--bundle-identifier` or `--package-name`
8+
* Added `webhooks` service with full pull and push support for project webhooks
9+
* Added `project` service with `update-canonical-emails`, `update-disposable-emails`, `update-free-emails` commands
10+
* Added `protocols` configuration section for REST, GraphQL, and WebSocket protocol status
11+
* Added `--purge` option to `databases update-collection` and `tables-db update-table` commands
12+
* Added `x` (Twitter/X) as supported OAuth2 provider
13+
* Fixed console URL generation to normalize cloud.appwrite.io subdomains
14+
* Fixed Linuxbrew path detection in update command
15+
316
## 17.4.0
417

518
* Added `--activate` flag for `push function` to control deployment activation

Formula/appwrite.rb

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,68 @@
1-
require "language/node"
2-
31
class Appwrite < Formula
4-
desc "CLI is a Node based command-line tool for Appwrite API"
2+
desc "Command-line tool for interacting with the Appwrite API"
53
homepage "https://appwrite.io"
64
license "BSD-3-Clause"
7-
head "https://github.com/appwrite/sdk-for-cli.git", branch: "master"
5+
version "18.0.0"
6+
7+
def self.binary_arch
8+
Hardware::CPU.arm? ? "arm64" : "x64"
9+
end
810

9-
depends_on "node"
11+
def self.binary_os
12+
return "darwin" if OS.mac?
13+
return "linux" if OS.linux?
14+
15+
raise "Homebrew formula is only supported on macOS and Linux"
16+
end
17+
18+
def self.binary_name
19+
"appwrite-cli-#{binary_os}-#{binary_arch}"
20+
end
21+
22+
def self.build_target
23+
return "mac-#{binary_arch}" if OS.mac?
24+
return "linux-#{binary_arch}" if OS.linux?
25+
26+
raise "Homebrew formula is only supported on macOS and Linux"
27+
end
28+
29+
# Release automation injects per-target SHA256 values when publishing binaries.
30+
on_macos do
31+
if Hardware::CPU.arm?
32+
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-darwin-arm64"
33+
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
34+
else
35+
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-darwin-x64"
36+
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
37+
end
38+
end
39+
40+
on_linux do
41+
if Hardware::CPU.arm?
42+
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-linux-arm64"
43+
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
44+
else
45+
url "https://github.com/appwrite/sdk-for-cli/releases/download/#{version}/appwrite-cli-linux-x64"
46+
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
47+
end
48+
end
49+
50+
head "https://github.com/appwrite/sdk-for-cli.git", branch: "master" do
51+
depends_on "bun" => :build
52+
end
1053

1154
def install
12-
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
13-
bin.install_symlink Dir["#{libexec}/bin/*"]
55+
if build.head?
56+
system "bun", "install", "--frozen-lockfile"
57+
system "bun", "run", self.class.build_target
58+
bin.install "build/#{self.class.binary_name}" => "appwrite"
59+
return
60+
end
61+
62+
bin.install self.class.binary_name => "appwrite"
1463
end
1564

1665
test do
17-
system "true"
66+
assert_match "Usage:", shell_output("#{bin}/appwrite --help")
1867
end
19-
end
68+
end

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Command Line SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.9.1-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
@@ -14,7 +14,7 @@ Appwrite is an open-source backend as a service server that abstracts and simpli
1414

1515
## Installation
1616

17-
The Appwrite CLI is a Node based command line tool to help you interact with the Appwrite API. The CLI is distributed both as an [`npm package`](https://www.npmjs.com/package/appwrite-cli) as well as [pre built binaries](https://github.com/appwrite/sdk-for-cli/releases/latest) for specific operating systems and architectures.
17+
The Appwrite CLI is a command line tool to help you interact with the Appwrite API. The CLI is distributed both as an [`npm package`](https://www.npmjs.com/package/appwrite-cli) as well as [native binaries](https://github.com/appwrite/sdk-for-cli/releases/latest) for specific operating systems and architectures.
1818

1919
### Install using NPM
2020
---
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
2929

3030
```sh
3131
$ appwrite -v
32-
17.4.0
32+
18.0.0
3333
```
3434

3535
### Install using prebuilt binaries
@@ -47,6 +47,8 @@ $ wget -q https://appwrite.io/cli/install.sh -O - | /bin/bash
4747
$ brew install appwrite
4848
```
4949

50+
Homebrew installs the native binary for your platform.
51+
5052
### Windows
5153
Via Powershell
5254
```powershell
@@ -60,7 +62,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
6062
Once the installation completes, you can verify your install using
6163
```
6264
$ appwrite -v
63-
17.4.0
65+
18.0.0
6466
```
6567

6668
## Getting Started

0 commit comments

Comments
 (0)