mirror of
https://github.com/dnote/dnote
synced 2026-03-14 14:35:50 +01:00
Build cli v0.15.2 (#684)
This commit is contained in:
parent
5df3e7af70
commit
a62c7f9e93
10 changed files with 108 additions and 25 deletions
58
.github/workflows/release-cli.yml
vendored
Normal file
58
.github/workflows/release-cli.yml
vendored
Normal file
|
|
@ -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
|
||||||
|
|
@ -213,6 +213,11 @@ The following log documentes the history of the CLI project
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
|
### 0.15.2 - 2025-10-05
|
||||||
|
|
||||||
|
* Support for 32bit linux, freebsd amd64, mac arm64.
|
||||||
|
* Remove Pro.
|
||||||
|
|
||||||
### 0.15.1 - 2024-02-03
|
### 0.15.1 - 2024-02-03
|
||||||
|
|
||||||
* Upgrade `color` dependency (#660).
|
* Upgrade `color` dependency (#660).
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -95,13 +95,13 @@ endif
|
||||||
@${currentDir}/scripts/release.sh cli $(version) ${cliOutputDir}
|
@${currentDir}/scripts/release.sh cli $(version) ${cliOutputDir}
|
||||||
.PHONY: release-cli
|
.PHONY: release-cli
|
||||||
|
|
||||||
release-cli-homebrew: clean build-cli
|
release-cli-homebrew:
|
||||||
ifndef version
|
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
|
endif
|
||||||
|
|
||||||
@echo "==> releasing cli on Homebrew"
|
@echo "==> releasing cli on Homebrew"
|
||||||
@${currentDir}/scripts/cli/release-homebrew.sh $(version) ${cliOutputDir}
|
@${currentDir}/scripts/cli/release-homebrew.sh $(version)
|
||||||
.PHONY: release-cli
|
.PHONY: release-cli
|
||||||
|
|
||||||
release-server:
|
release-server:
|
||||||
|
|
|
||||||
17
install.sh
17
install.sh
|
|
@ -68,9 +68,14 @@ uname_os() {
|
||||||
|
|
||||||
uname_arch() {
|
uname_arch() {
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
case $arch in
|
case $arch in
|
||||||
x86_64) arch="amd64" ;;
|
x86_64) arch="amd64" ;;
|
||||||
aarch64) arch="arm64" ;;
|
aarch64) arch="arm64" ;;
|
||||||
|
arm64) arch="arm64" ;;
|
||||||
|
armv7l) arch="arm" ;;
|
||||||
|
armv6l) arch="arm" ;;
|
||||||
|
armv5l) arch="arm" ;;
|
||||||
|
arm) arch="arm" ;;
|
||||||
x86) arch="386" ;;
|
x86) arch="386" ;;
|
||||||
i686) arch="386" ;;
|
i686) arch="386" ;;
|
||||||
i386) arch="386" ;;
|
i386) arch="386" ;;
|
||||||
|
|
@ -86,9 +91,17 @@ check_platform() {
|
||||||
|
|
||||||
found=1
|
found=1
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
darwin/amd64) found=0;;
|
# Linux
|
||||||
linux/amd64) found=0 ;;
|
linux/amd64) found=0 ;;
|
||||||
linux/arm64) 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
|
esac
|
||||||
|
|
||||||
return $found
|
return $found
|
||||||
|
|
|
||||||
|
|
@ -126,10 +126,6 @@ func getBaseURL(rawURL string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getServerDisplayURL(ctx context.DnoteCtx) string {
|
func getServerDisplayURL(ctx context.DnoteCtx) string {
|
||||||
if ctx.APIEndpoint == "https://api.getdnote.com" {
|
|
||||||
return "https://www.getdnote.com"
|
|
||||||
}
|
|
||||||
|
|
||||||
baseURL, err := getBaseURL(ctx.APIEndpoint)
|
baseURL, err := getBaseURL(ctx.APIEndpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,6 @@ func TestGetServerDisplayURL(t *testing.T) {
|
||||||
apiEndpoint string
|
apiEndpoint string
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{
|
|
||||||
apiEndpoint: "https://api.getdnote.com",
|
|
||||||
expected: "https://www.getdnote.com",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
apiEndpoint: "https://dnote.mydomain.com/api",
|
apiEndpoint: "https://dnote.mydomain.com/api",
|
||||||
expected: "https://dnote.mydomain.com",
|
expected: "https://dnote.mydomain.com",
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* along with Dnote. If not, see <https://www.gnu.org/licenses/>.
|
* along with Dnote. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//go:build linux || darwin
|
//go:build linux || darwin || freebsd
|
||||||
|
|
||||||
|
|
||||||
package dirs
|
package dirs
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* along with Dnote. If not, see <https://www.gnu.org/licenses/>.
|
* along with Dnote. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//go:build linux || darwin
|
//go:build linux || darwin || freebsd
|
||||||
|
|
||||||
|
|
||||||
package dirs
|
package dirs
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ if [[ $1 == v* ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
goVersion=go-1.21.x
|
goVersion=go-1.25.x
|
||||||
|
|
||||||
get_binary_name() {
|
get_binary_name() {
|
||||||
platform=$1
|
platform=$1
|
||||||
|
|
@ -57,7 +57,7 @@ build() {
|
||||||
|
|
||||||
# build binary
|
# build binary
|
||||||
destDir="$outputDir/$platform-$arch"
|
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"
|
tags="fts5"
|
||||||
|
|
||||||
pushd "$projectDir"
|
pushd "$projectDir"
|
||||||
|
|
@ -92,7 +92,7 @@ build() {
|
||||||
popd
|
popd
|
||||||
|
|
||||||
binaryName=$(get_binary_name "$platform")
|
binaryName=$(get_binary_name "$platform")
|
||||||
mv "$destDir/cli-${platform}-"* "$destDir/$binaryName"
|
mv "$destDir/cli-"* "$destDir/$binaryName"
|
||||||
|
|
||||||
# build tarball
|
# build tarball
|
||||||
tarballName="dnote_${version}_${platform}_${arch}.tar.gz"
|
tarballName="dnote_${version}_${platform}_${arch}.tar.gz"
|
||||||
|
|
@ -113,10 +113,20 @@ if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then
|
||||||
# install the tool
|
# install the tool
|
||||||
go install src.techknowlogick.com/xgo@latest
|
go install src.techknowlogick.com/xgo@latest
|
||||||
|
|
||||||
|
# Linux
|
||||||
build linux amd64
|
build linux amd64
|
||||||
build linux arm64
|
build linux arm64
|
||||||
|
build linux arm
|
||||||
|
|
||||||
|
# macOS
|
||||||
build darwin amd64
|
build darwin amd64
|
||||||
|
build darwin arm64
|
||||||
|
|
||||||
|
# Windows
|
||||||
build windows amd64
|
build windows amd64
|
||||||
|
|
||||||
|
# FreeBSD
|
||||||
|
build freebsd amd64
|
||||||
else
|
else
|
||||||
build "$GOOS" "$GOARCH" true
|
build "$GOOS" "$GOARCH" true
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,13 @@ if [ ! -d "$cliHomebrewDir" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
version=$1
|
version=$1
|
||||||
tarball=$2
|
|
||||||
|
|
||||||
echo "version: $version"
|
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"
|
pushd "$cliHomebrewDir"
|
||||||
|
|
||||||
|
|
@ -25,14 +26,18 @@ git pull origin master
|
||||||
|
|
||||||
cat > ./Formula/dnote.rb << EOF
|
cat > ./Formula/dnote.rb << EOF
|
||||||
class Dnote < Formula
|
class Dnote < Formula
|
||||||
desc "A simple command line notebook for programmers"
|
desc "Simple command line notebook for programmers"
|
||||||
homepage "https://www.getdnote.com"
|
homepage "https://www.getdnote.com"
|
||||||
url "https://github.com/dnote/dnote/releases/download/cli-v${version}/dnote_${version}_darwin_amd64.tar.gz"
|
url "https://github.com/dnote/dnote/archive/refs/tags/cli-v${version}.tar.gz"
|
||||||
version "${version}"
|
|
||||||
sha256 "${sha}"
|
sha256 "${sha}"
|
||||||
|
license "GPL-3.0"
|
||||||
|
head "https://github.com/dnote/dnote.git", branch: "master"
|
||||||
|
|
||||||
|
depends_on "go" => :build
|
||||||
|
|
||||||
def install
|
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
|
end
|
||||||
|
|
||||||
test do
|
test do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue