diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bac0819 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: ci + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: gofmt + run: test -z "$(gofmt -l .)" + - run: go vet ./... + - run: go build ./... + - run: go test -race ./... + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - uses: golangci/golangci-lint-action@v8 + with: + version: latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..911f348 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # full history for the changelog + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - run: go test -race ./... + - uses: goreleaser/goreleaser-action@v6 + with: + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # PAT with write access to qf-studio/homebrew-tap (formula push). + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..9c83090 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,48 @@ +version: 2 + +project_name: grot + +before: + hooks: + - go mod tidy + +builds: + - main: ./cmd/grot + env: + - CGO_ENABLED=0 + goos: [darwin, linux] + goarch: [amd64, arm64] + ldflags: + - -s -w + - -X main.version={{.Version}} + - -X main.buildTime={{.Date}} + +archives: + - formats: [tar.gz] + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + +checksum: + name_template: checksums.txt + +changelog: + sort: asc + filters: + exclude: + - "^docs" + - "^chore" + - "^test" + +homebrew_casks: + - repository: + owner: qf-studio + name: homebrew-tap + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + homepage: https://github.com/qf-studio/grot + description: btop-style terminal dashboards for Prometheus & Grafana + # Unsigned binary: strip the quarantine bit so Gatekeeper doesn't block it. + hooks: + post: + install: | + if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0 + system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/grot"] + end diff --git a/README.md b/README.md index 6a6628c..7604d01 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,12 @@ Grafana dashboard JSON and get the same layout in your terminal. ## Install ```bash +brew install --cask qf-studio/tap/grot # macOS / Linux go install github.com/qf-studio/grot/cmd/grot@latest ``` -Homebrew tap lands with v0.1.0. +Prebuilt binaries for darwin/linux (amd64 + arm64) on the +[releases page](https://github.com/qf-studio/grot/releases). ## Quick start