Skip to content

Commit a62c7f9

Browse files
authored
Build cli v0.15.2 (#684)
1 parent 5df3e7a commit a62c7f9

File tree

10 files changed

+108
-25
lines changed

10 files changed

+108
-25
lines changed

.github/workflows/release-cli.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release CLI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'cli-v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-22.04
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v5
16+
- uses: actions/setup-go@v6
17+
with:
18+
go-version: '>=1.25.0'
19+
20+
- name: Extract version from tag
21+
id: version
22+
run: |
23+
TAG=${GITHUB_REF#refs/tags/cli-v}
24+
echo "version=$TAG" >> $GITHUB_OUTPUT
25+
echo "Releasing version: $TAG"
26+
27+
- name: Install dependencies
28+
run: make install
29+
30+
- name: Run CLI tests
31+
run: make test-cli
32+
33+
- name: Run E2E tests
34+
run: make test-e2e
35+
36+
- name: Build CLI
37+
run: make version=${{ steps.version.outputs.version }} build-cli
38+
39+
- name: Create GitHub release
40+
env:
41+
GH_TOKEN: ${{ github.token }}
42+
run: |
43+
VERSION="${{ steps.version.outputs.version }}"
44+
TAG="cli-v${VERSION}"
45+
46+
# Determine if prerelease (version not matching major.minor.patch)
47+
FLAGS=""
48+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
49+
FLAGS="--prerelease"
50+
fi
51+
52+
gh release create "$TAG" \
53+
build/cli/*.tar.gz \
54+
build/cli/*_checksums.txt \
55+
$FLAGS \
56+
--title="$TAG" \
57+
--notes="Please see the [CHANGELOG](https://github.com/dnote/dnote/blob/master/CHANGELOG.md)" \
58+
--draft

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ The following log documentes the history of the CLI project
213213

214214
None
215215

216+
### 0.15.2 - 2025-10-05
217+
218+
* Support for 32bit linux, freebsd amd64, mac arm64.
219+
* Remove Pro.
220+
216221
### 0.15.1 - 2024-02-03
217222

218223
* Upgrade `color` dependency (#660).

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ endif
9595
@${currentDir}/scripts/release.sh cli $(version) ${cliOutputDir}
9696
.PHONY: release-cli
9797

98-
release-cli-homebrew: clean build-cli
98+
release-cli-homebrew:
9999
ifndef version
100-
$(error version is required. Usage: make version=0.1.0 release-cli)
100+
$(error version is required. Usage: make version=0.1.0 release-cli-homebrew)
101101
endif
102102

103103
@echo "==> releasing cli on Homebrew"
104-
@${currentDir}/scripts/cli/release-homebrew.sh $(version) ${cliOutputDir}
104+
@${currentDir}/scripts/cli/release-homebrew.sh $(version)
105105
.PHONY: release-cli
106106

107107
release-server:

install.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ uname_os() {
6868

6969
uname_arch() {
7070
arch=$(uname -m)
71-
case $arch in
71+
case $arch in
7272
x86_64) arch="amd64" ;;
7373
aarch64) arch="arm64" ;;
74+
arm64) arch="arm64" ;;
75+
armv7l) arch="arm" ;;
76+
armv6l) arch="arm" ;;
77+
armv5l) arch="arm" ;;
78+
arm) arch="arm" ;;
7479
x86) arch="386" ;;
7580
i686) arch="386" ;;
7681
i386) arch="386" ;;
@@ -86,9 +91,17 @@ check_platform() {
8691

8792
found=1
8893
case "$platform" in
89-
darwin/amd64) found=0;;
94+
# Linux
9095
linux/amd64) found=0 ;;
9196
linux/arm64) found=0 ;;
97+
linux/arm) found=0 ;;
98+
# macOS
99+
darwin/amd64) found=0 ;;
100+
darwin/arm64) found=0 ;;
101+
# Windows
102+
windows/amd64) found=0 ;;
103+
# FreeBSD
104+
freebsd/amd64) found=0 ;;
92105
esac
93106

94107
return $found

pkg/cli/cmd/login/login.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ func getBaseURL(rawURL string) (string, error) {
126126
}
127127

128128
func getServerDisplayURL(ctx context.DnoteCtx) string {
129-
if ctx.APIEndpoint == "https://api.getdnote.com" {
130-
return "https://www.getdnote.com"
131-
}
132-
133129
baseURL, err := getBaseURL(ctx.APIEndpoint)
134130
if err != nil {
135131
return ""

pkg/cli/cmd/login/login_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ func TestGetServerDisplayURL(t *testing.T) {
3131
apiEndpoint string
3232
expected string
3333
}{
34-
{
35-
apiEndpoint: "https://api.getdnote.com",
36-
expected: "https://www.getdnote.com",
37-
},
3834
{
3935
apiEndpoint: "https://dnote.mydomain.com/api",
4036
expected: "https://dnote.mydomain.com",

pkg/dirs/dirs_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* along with Dnote. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
//go:build linux || darwin
19+
//go:build linux || darwin || freebsd
2020

2121

2222
package dirs

pkg/dirs/dirs_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* along with Dnote. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
//go:build linux || darwin
19+
//go:build linux || darwin || freebsd
2020

2121

2222
package dirs

scripts/cli/build.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [[ $1 == v* ]]; then
3636
exit 1
3737
fi
3838

39-
goVersion=go-1.21.x
39+
goVersion=go-1.25.x
4040

4141
get_binary_name() {
4242
platform=$1
@@ -57,7 +57,7 @@ build() {
5757

5858
# build binary
5959
destDir="$outputDir/$platform-$arch"
60-
ldflags="-X main.apiEndpoint=https://api.getdnote.com -X main.versionTag=$version"
60+
ldflags="-X main.apiEndpoint=https://localhost:3000/api -X main.versionTag=$version"
6161
tags="fts5"
6262

6363
pushd "$projectDir"
@@ -92,7 +92,7 @@ build() {
9292
popd
9393

9494
binaryName=$(get_binary_name "$platform")
95-
mv "$destDir/cli-${platform}-"* "$destDir/$binaryName"
95+
mv "$destDir/cli-"* "$destDir/$binaryName"
9696

9797
# build tarball
9898
tarballName="dnote_${version}_${platform}_${arch}.tar.gz"
@@ -113,10 +113,20 @@ if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then
113113
# install the tool
114114
go install src.techknowlogick.com/xgo@latest
115115

116+
# Linux
116117
build linux amd64
117118
build linux arm64
119+
build linux arm
120+
121+
# macOS
118122
build darwin amd64
123+
build darwin arm64
124+
125+
# Windows
119126
build windows amd64
127+
128+
# FreeBSD
129+
build freebsd amd64
120130
else
121131
build "$GOOS" "$GOARCH" true
122132
fi

scripts/cli/release-homebrew.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ if [ ! -d "$cliHomebrewDir" ]; then
1010
fi
1111

1212
version=$1
13-
tarball=$2
1413

1514
echo "version: $version"
16-
echo "tarball: $tarball"
1715

18-
sha=$(shasum -a 256 "$tarball" | cut -d ' ' -f 1)
16+
# Download source tarball and calculate SHA256
17+
source_url="https://github.com/dnote/dnote/archive/refs/tags/cli-v${version}.tar.gz"
18+
echo "Calculating SHA256 for: $source_url"
19+
sha=$(curl -L "$source_url" | shasum -a 256 | cut -d ' ' -f 1)
1920

2021
pushd "$cliHomebrewDir"
2122

@@ -25,14 +26,18 @@ git pull origin master
2526

2627
cat > ./Formula/dnote.rb << EOF
2728
class Dnote < Formula
28-
desc "A simple command line notebook for programmers"
29+
desc "Simple command line notebook for programmers"
2930
homepage "https://www.getdnote.com"
30-
url "https://github.com/dnote/dnote/releases/download/cli-v${version}/dnote_${version}_darwin_amd64.tar.gz"
31-
version "${version}"
31+
url "https://github.com/dnote/dnote/archive/refs/tags/cli-v${version}.tar.gz"
3232
sha256 "${sha}"
33+
license "GPL-3.0"
34+
head "https://github.com/dnote/dnote.git", branch: "master"
35+
36+
depends_on "go" => :build
3337
3438
def install
35-
bin.install "dnote"
39+
ldflags = "-s -w -X main.apiEndpoint=https://api.getdnote.com -X main.versionTag=#{version}"
40+
system "go", "build", *std_go_args(ldflags: ldflags), "-tags", "fts5", "./pkg/cli"
3641
end
3742
3843
test do

0 commit comments

Comments
 (0)