Skip to content

Commit 619c882

Browse files
Release Pipeline (#9)
* Initial basic .goreleaser.yaml * Initial sketch of .goreleaser.yaml with support for S3 uploads, Linux packages, and homebrew casks * Update license info, include LICENSE and NOTICE in archive * Initial iteration of install.sh script * Skip updating latest.txt for prerelease versions * Improve and clean up .goreleaser.yaml * Use latest Go version * Initial sketch of GitHub Actions release workflow * Remove boilerplate comments from .goreleaser.yaml * Save install script to top-level of S3 bucket * Remove S3 stuff, download directly from GitHub * Update install script to accept optional VERSION env var * Use API_TOKEN_GITHUB_CLOUD for homebrew tap publish * Download from S3 instead of GitHub This reverts commit 5cf721e. * Fix writing latest.txt file * Fix secret access key * Fix S3 bucket ACL issue * Rename module path in all files * Set build-time variables in release pipeline * Fix S3 path for installation artifacts * Fix S3 path in install.sh script * Fix built binary name * Remove release pipeline TODO * Improve install script * Improve logic for selecting install directory * Add comment to top of install.sh script * Verify checksums in scripts/install.sh * Fix verify_installation logic * Consolidate download-with-retry logic * Refactor and rearrange functions in install.sh script * Update installation instructions in README.md * Fix bug in checksum validation logic * Add direct download and linux package instructions * Minor .goreleaser.yaml fixes * Build pre-release for homebrew * Once again skip homebrew publish for prerelease packages * Clean up README.md * Attempt to fix disabling install directory S3 uploads for prereleases * Remove /usr/local/bin as an install directory candidate, eliminate sudo calls, improve logic for finding install dir * Make shasum or sha256sum required * Get started with: tiger auth login * Exponential backoff for download failures
1 parent bccabd2 commit 619c882

File tree

8 files changed

+680
-17
lines changed

8 files changed

+680
-17
lines changed

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v6
22+
with:
23+
go-version-file: 'go.mod'
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v6
27+
with:
28+
distribution: goreleaser
29+
version: "~> v2"
30+
args: release --clean
31+
env:
32+
# Action-scoped GitHub token used for downloading code, etc.
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
# Cross-repo GitHub token for publishing to timescale/homebrew-tap
35+
TAP_GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB_CLOUD }}
36+
# AWS credentials for pushing to tiger-cli-releases S3 bucket
37+
AWS_ACCESS_KEY_ID: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }}
38+
AWS_SECRET_ACCESS_KEY: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }}
39+
AWS_REGION: us-east-1

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@ config.yaml
4545
*.key
4646
*.pem
4747
.env*
48-
!.env.sample
48+
!.env.sample
49+
50+
# Build artifacts
51+
latest.txt

.goreleaser.yaml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
3+
version: 2
4+
5+
project_name: tiger-cli
6+
7+
# Create VERSION file before building
8+
before:
9+
hooks:
10+
- sh -c 'echo "{{ .Tag }}" > latest.txt'
11+
12+
builds:
13+
- main: ./cmd/tiger
14+
binary: tiger
15+
env:
16+
- CGO_ENABLED=0
17+
goos:
18+
- linux
19+
- windows
20+
- darwin
21+
goarch:
22+
- 386
23+
- amd64
24+
- arm64
25+
ldflags:
26+
- -s -w
27+
- -X github.com/timescale/tiger-cli/internal/tiger/cmd.Version={{.Version}}
28+
- -X github.com/timescale/tiger-cli/internal/tiger/cmd.BuildTime={{.Date}}
29+
- -X github.com/timescale/tiger-cli/internal/tiger/cmd.GitCommit={{.Commit}}
30+
31+
archives:
32+
- id: archive
33+
formats: [tar.gz]
34+
35+
# use zip for windows archives
36+
format_overrides:
37+
- goos: windows
38+
formats: [zip]
39+
40+
# this name template makes the OS and Arch compatible with the results of `uname`.
41+
name_template: >-
42+
{{ .ProjectName }}_
43+
{{- title .Os }}_
44+
{{- if eq .Arch "amd64" }}x86_64
45+
{{- else if eq .Arch "386" }}i386
46+
{{- else }}{{ .Arch }}{{ end }}
47+
{{- if .Arm }}v{{ .Arm }}{{ end }}
48+
49+
files:
50+
- README.md
51+
- LICENSE
52+
- NOTICE
53+
54+
# Linux package configuration (APT, RPM, etc.)
55+
nfpms:
56+
- id: packages
57+
package_name: tiger-cli
58+
vendor: Timescale, Inc., d/b/a TigerData
59+
homepage: https://github.com/timescale/tiger-cli
60+
maintainer: TigerData <support@tigerdata.com>
61+
description: |-
62+
Tiger CLI - TigerData Cloud Platform CLI
63+
Command-line interface for managing TigerData Cloud Platform resources
64+
license: Apache-2.0
65+
formats:
66+
- deb
67+
- rpm
68+
- apk
69+
bindir: /usr/bin
70+
priority: extra
71+
file_name_template: "{{ .ConventionalFileName }}"
72+
rpm:
73+
group: Unspecified
74+
deb:
75+
lintian_overrides:
76+
- statically-linked-binary
77+
78+
79+
# S3 Blob Storage Configuration
80+
blobs:
81+
# Versioned release artifacts
82+
- provider: s3
83+
bucket: tiger-cli-releases
84+
region: us-east-1
85+
directory: "releases/{{ .Tag }}"
86+
ids:
87+
- archive # Archive ID
88+
- packages # nfpms package ID
89+
90+
# Upload install script and latest version file to bucket root (skip for prereleases)
91+
- provider: s3
92+
bucket: tiger-cli-releases
93+
region: us-east-1
94+
directory: "install"
95+
extra_files_only: true
96+
disable: '{{ ne .Prerelease "" }}' # Skip this step for pre-releases
97+
extra_files:
98+
- glob: ./latest.txt
99+
name_template: "latest.txt"
100+
- glob: ./scripts/install.sh
101+
name_template: "install.sh"
102+
103+
# Homebrew cask configuration
104+
homebrew_casks:
105+
- name: tiger-cli
106+
107+
repository:
108+
owner: timescale
109+
name: homebrew-tap
110+
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
111+
homepage: https://github.com/timescale/tiger-cli
112+
description: |-
113+
Tiger CLI - TigerData Cloud Platform CLI
114+
Command-line interface for managing TigerData Cloud Platform resources
115+
binary: tiger
116+
license: Apache-2.0
117+
skip_upload: auto
118+
url:
119+
template: "https://tiger-cli-releases.s3.us-east-1.amazonaws.com/releases/{{ .Tag }}/{{ .ArtifactName }}"
120+
hooks:
121+
# TODO: Sign and notarize instead of removing quarantine bit
122+
# See: https://goreleaser.com/customization/homebrew_casks/#signing-and-notarizing
123+
post:
124+
install: |
125+
if OS.mac?
126+
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/tiger"]
127+
end
128+
# Optional: Add caveats for user instructions
129+
caveats: |
130+
Tiger CLI has been installed successfully!
131+
132+
Get started with:
133+
tiger auth login
134+
135+
For help:
136+
tiger --help
137+
138+
# Checksum configuration - split into individual files for easier validation
139+
checksum:
140+
split: true
141+
142+
changelog:
143+
sort: asc
144+
filters:
145+
exclude:
146+
- "^specs:"
147+
# TODO: Other files that should be ignored
148+
149+
# Release configuration
150+
release:
151+
github:
152+
owner: timescale
153+
name: tiger-cli
154+
draft: false
155+
prerelease: auto
156+
name_template: "Release {{ .Tag }}"

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,35 @@ tiger auth login
2929
tiger --help
3030
```
3131

32-
3332
## Installation
3433

34+
### Install script
35+
```bash
36+
curl -fsSL https://tiger-cli-releases.s3.amazonaws.com/install/install.sh | sh
37+
```
38+
3539
### Homebrew (macOS/Linux)
3640
```bash
37-
brew install tigerdata/tap/tiger
41+
brew install timescale/tap/tiger-cli
3842
```
3943

4044
### Go install
4145
```bash
42-
go install github.com/tigerdata/tiger-cli/cmd/tiger@latest
46+
go install github.com/timescale/tiger-cli/cmd/tiger@latest
4347
```
4448

4549
### Direct binary download
4650
```bash
47-
curl -L https://github.com/tigerdata/tiger-cli/releases/latest/download/tiger-$(uname -s)-$(uname -m) -o tiger
51+
curl -LO https://github.com/timescale/tiger-cli/releases/latest/download/tiger-cli_$(uname -s)_$(uname -m).tar.gz
52+
tar -xzf tiger-cli_$(uname -s)_$(uname -m).tar.gz
4853
chmod +x tiger
49-
mv tiger /usr/local/bin/
54+
mkdir -p ~/.local/bin && mv tiger ~/.local/bin/
55+
```
56+
57+
### Debian/Ubuntu package
58+
```bash
59+
curl -LO https://github.com/timescale/tiger-cli/releases/latest/download/tiger-cli_linux_$(dpkg --print-architecture).deb
60+
sudo dpkg -i tiger-cli_linux_$(dpkg --print-architecture).deb
5061
```
5162

5263
## Usage
@@ -175,4 +186,4 @@ tiger-cli/
175186

176187
## License
177188

178-
[License information to be added]
189+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

TODO.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ Blocked:
66

77
Active List:
88
- should we alias the auth login command to login?
9-
- add release tooling
10-
- goreleaser?
11-
- platforms:
12-
- apt
13-
- brew
14-
- curl .sh script
159

1610
Done:
1711
- ✅ update exit codes for authentication and permission errors

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/timescale/tiger-cli
22

3-
go 1.23.0
4-
5-
toolchain go1.24.6
3+
go 1.25.1
64

75
require (
86
github.com/charmbracelet/bubbletea v1.3.6
@@ -15,6 +13,7 @@ require (
1513
github.com/zalando/go-keyring v0.2.6
1614
go.uber.org/mock v0.5.2
1715
go.uber.org/zap v1.27.0
16+
golang.org/x/oauth2 v0.30.0
1817
golang.org/x/term v0.33.0
1918
gopkg.in/yaml.v3 v3.0.1
2019
)
@@ -73,7 +72,6 @@ require (
7372
go.uber.org/multierr v1.11.0 // indirect
7473
golang.org/x/crypto v0.37.0 // indirect
7574
golang.org/x/mod v0.25.0 // indirect
76-
golang.org/x/oauth2 v0.30.0 // indirect
7775
golang.org/x/sync v0.16.0 // indirect
7876
golang.org/x/sys v0.34.0 // indirect
7977
golang.org/x/text v0.27.0 // indirect

internal/tiger/cmd/version.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"github.com/spf13/cobra"
88
)
99

10+
// These variables are set at build time via ldflags in the GoReleaser pipeline
11+
// for production releases. Default values are used for local development builds.
1012
var Version = "dev"
1113
var BuildTime = "unknown"
1214
var GitCommit = "unknown"

0 commit comments

Comments
 (0)