diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml new file mode 100644 index 00000000..65b2fd0b --- /dev/null +++ b/.github/workflows/release-cli.yml @@ -0,0 +1,58 @@ +name: Release CLI + +on: + push: + tags: + - 'cli-v*' + +jobs: + release: + runs-on: ubuntu-22.04 + permissions: + contents: write + + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 + with: + go-version: '>=1.25.0' + + - name: Extract version from tag + id: version + run: | + TAG=${GITHUB_REF#refs/tags/cli-v} + echo "version=$TAG" >> $GITHUB_OUTPUT + echo "Releasing version: $TAG" + + - name: Install dependencies + run: make install + + - name: Run CLI tests + run: make test-cli + + - name: Run E2E tests + run: make test-e2e + + - name: Build CLI + run: make version=${{ steps.version.outputs.version }} build-cli + + - name: Create GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION="${{ steps.version.outputs.version }}" + TAG="cli-v${VERSION}" + + # Determine if prerelease (version not matching major.minor.patch) + FLAGS="" + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + FLAGS="--prerelease" + fi + + gh release create "$TAG" \ + build/cli/*.tar.gz \ + build/cli/*_checksums.txt \ + $FLAGS \ + --title="$TAG" \ + --notes="Please see the [CHANGELOG](https://github.com/dnote/dnote/blob/master/CHANGELOG.md)" \ + --draft diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ef92b2e..431232b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -213,6 +213,11 @@ The following log documentes the history of the CLI project None +### 0.15.2 - 2025-10-05 + +* Support for 32bit linux, freebsd amd64, mac arm64. +* Remove Pro. + ### 0.15.1 - 2024-02-03 * Upgrade `color` dependency (#660). diff --git a/Makefile b/Makefile index 3b91d6ae..12cf32cf 100644 --- a/Makefile +++ b/Makefile @@ -95,13 +95,13 @@ endif @${currentDir}/scripts/release.sh cli $(version) ${cliOutputDir} .PHONY: release-cli -release-cli-homebrew: clean build-cli +release-cli-homebrew: ifndef version - $(error version is required. Usage: make version=0.1.0 release-cli) + $(error version is required. Usage: make version=0.1.0 release-cli-homebrew) endif @echo "==> releasing cli on Homebrew" - @${currentDir}/scripts/cli/release-homebrew.sh $(version) ${cliOutputDir} + @${currentDir}/scripts/cli/release-homebrew.sh $(version) .PHONY: release-cli release-server: diff --git a/install.sh b/install.sh index 6537232e..bb09bd8f 100755 --- a/install.sh +++ b/install.sh @@ -68,9 +68,14 @@ uname_os() { uname_arch() { arch=$(uname -m) - case $arch in + case $arch in x86_64) arch="amd64" ;; aarch64) arch="arm64" ;; + arm64) arch="arm64" ;; + armv7l) arch="arm" ;; + armv6l) arch="arm" ;; + armv5l) arch="arm" ;; + arm) arch="arm" ;; x86) arch="386" ;; i686) arch="386" ;; i386) arch="386" ;; @@ -86,9 +91,17 @@ check_platform() { found=1 case "$platform" in - darwin/amd64) found=0;; + # Linux linux/amd64) found=0 ;; linux/arm64) found=0 ;; + linux/arm) found=0 ;; + # macOS + darwin/amd64) found=0 ;; + darwin/arm64) found=0 ;; + # Windows + windows/amd64) found=0 ;; + # FreeBSD + freebsd/amd64) found=0 ;; esac return $found diff --git a/pkg/cli/cmd/login/login.go b/pkg/cli/cmd/login/login.go index 42df6c77..1e667382 100644 --- a/pkg/cli/cmd/login/login.go +++ b/pkg/cli/cmd/login/login.go @@ -126,10 +126,6 @@ func getBaseURL(rawURL string) (string, error) { } func getServerDisplayURL(ctx context.DnoteCtx) string { - if ctx.APIEndpoint == "https://api.getdnote.com" { - return "https://www.getdnote.com" - } - baseURL, err := getBaseURL(ctx.APIEndpoint) if err != nil { return "" diff --git a/pkg/cli/cmd/login/login_test.go b/pkg/cli/cmd/login/login_test.go index 47807c1f..c208fa5d 100644 --- a/pkg/cli/cmd/login/login_test.go +++ b/pkg/cli/cmd/login/login_test.go @@ -31,10 +31,6 @@ func TestGetServerDisplayURL(t *testing.T) { apiEndpoint string expected string }{ - { - apiEndpoint: "https://api.getdnote.com", - expected: "https://www.getdnote.com", - }, { apiEndpoint: "https://dnote.mydomain.com/api", expected: "https://dnote.mydomain.com", diff --git a/pkg/dirs/dirs_unix.go b/pkg/dirs/dirs_unix.go index c6d525e5..59420c0e 100644 --- a/pkg/dirs/dirs_unix.go +++ b/pkg/dirs/dirs_unix.go @@ -16,7 +16,7 @@ * along with Dnote. If not, see . */ -//go:build linux || darwin +//go:build linux || darwin || freebsd package dirs diff --git a/pkg/dirs/dirs_unix_test.go b/pkg/dirs/dirs_unix_test.go index 3d821155..0ab63ad8 100644 --- a/pkg/dirs/dirs_unix_test.go +++ b/pkg/dirs/dirs_unix_test.go @@ -16,7 +16,7 @@ * along with Dnote. If not, see . */ -//go:build linux || darwin +//go:build linux || darwin || freebsd package dirs diff --git a/scripts/cli/build.sh b/scripts/cli/build.sh index 467f1282..c805ba90 100755 --- a/scripts/cli/build.sh +++ b/scripts/cli/build.sh @@ -36,7 +36,7 @@ if [[ $1 == v* ]]; then exit 1 fi -goVersion=go-1.21.x +goVersion=go-1.25.x get_binary_name() { platform=$1 @@ -57,7 +57,7 @@ build() { # build binary destDir="$outputDir/$platform-$arch" - ldflags="-X main.apiEndpoint=https://api.getdnote.com -X main.versionTag=$version" + ldflags="-X main.apiEndpoint=https://localhost:3000/api -X main.versionTag=$version" tags="fts5" pushd "$projectDir" @@ -92,7 +92,7 @@ build() { popd binaryName=$(get_binary_name "$platform") - mv "$destDir/cli-${platform}-"* "$destDir/$binaryName" + mv "$destDir/cli-"* "$destDir/$binaryName" # build tarball tarballName="dnote_${version}_${platform}_${arch}.tar.gz" @@ -113,10 +113,20 @@ if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then # install the tool go install src.techknowlogick.com/xgo@latest + # Linux build linux amd64 build linux arm64 + build linux arm + + # macOS build darwin amd64 + build darwin arm64 + + # Windows build windows amd64 + + # FreeBSD + build freebsd amd64 else build "$GOOS" "$GOARCH" true fi diff --git a/scripts/cli/release-homebrew.sh b/scripts/cli/release-homebrew.sh index 7e9a7bd5..f48f16dc 100755 --- a/scripts/cli/release-homebrew.sh +++ b/scripts/cli/release-homebrew.sh @@ -10,12 +10,13 @@ if [ ! -d "$cliHomebrewDir" ]; then fi version=$1 -tarball=$2 echo "version: $version" -echo "tarball: $tarball" -sha=$(shasum -a 256 "$tarball" | cut -d ' ' -f 1) +# Download source tarball and calculate SHA256 +source_url="https://github.com/dnote/dnote/archive/refs/tags/cli-v${version}.tar.gz" +echo "Calculating SHA256 for: $source_url" +sha=$(curl -L "$source_url" | shasum -a 256 | cut -d ' ' -f 1) pushd "$cliHomebrewDir" @@ -25,14 +26,18 @@ git pull origin master cat > ./Formula/dnote.rb << EOF class Dnote < Formula - desc "A simple command line notebook for programmers" + desc "Simple command line notebook for programmers" homepage "https://www.getdnote.com" - url "https://github.com/dnote/dnote/releases/download/cli-v${version}/dnote_${version}_darwin_amd64.tar.gz" - version "${version}" + url "https://github.com/dnote/dnote/archive/refs/tags/cli-v${version}.tar.gz" sha256 "${sha}" + license "GPL-3.0" + head "https://github.com/dnote/dnote.git", branch: "master" + + depends_on "go" => :build def install - bin.install "dnote" + ldflags = "-s -w -X main.apiEndpoint=https://api.getdnote.com -X main.versionTag=#{version}" + system "go", "build", *std_go_args(ldflags: ldflags), "-tags", "fts5", "./pkg/cli" end test do