Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
tags:
- 'v*'
branches:
- main
pull_request:
paths-ignore:
- '*.md'
Expand Down Expand Up @@ -35,10 +37,19 @@ jobs:
make test
make vet

- uses: goreleaser/goreleaser-action@v6
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
- name: tag release
if: github.ref == 'refs/heads/main'
run: |
VERSION=$(go run . --version)

if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping release"
else
echo "Creating new tag and release for $TAG"
git config user.name github-actions
git config user.email github-actions@github.com
git tag "$TAG"
git push origin "$TAG"
fi
env:
GITHUB_TOKEN: ${{ github.token }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release
on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write


jobs:
release:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: actions/setup-go@v4
with:
go-version: 1.25
cache: true

- name: create release
uses: goreleaser/goreleaser-action@v6
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ github.token }}
8 changes: 8 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package cmd

import (
"context"
"fmt"
"os"

"github.com/timtatt/sift/internal/sift"
)
Expand All @@ -10,11 +12,17 @@ type CLI struct {
Debug bool `name:"debug" short:"d" help:"enable debug view"`
RawLogs bool `name:"raw" short:"r" help:"disable prettified logs"`
NonInteractive bool `name:"non-interactive" short:"n" help:"disable interactive mode"`
Version bool `name:"version" short:"v" help:"print version"`
}

func (c *CLI) Run() error {
ctx := context.Background()

if c.Version {
fmt.Print(sift.Version)
os.Exit(0)
}

return sift.Run(ctx, sift.SiftOptions{
Debug: c.Debug,
NonInteractive: c.NonInteractive,
Expand Down
2 changes: 2 additions & 0 deletions internal/sift/interactive_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func (m *siftModel) interactiveView() string {
header += styleSecondary.Render(" [AUTO TOGGLE MODE]")
}

header += " " + lipgloss.NewStyle().Foreground(colorMutedBlue).Render(Version)

if m.opts.Debug {
header += fmt.Sprintf(" cursor: [%d, %d] %d | yoffset: %d, bottom %d", m.cursor.test, m.cursor.log, m.GetCursorPos(), m.viewport.YOffset, m.viewport.YOffset+m.viewport.Height)

Expand Down
3 changes: 3 additions & 0 deletions internal/sift/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package sift

var Version = "v0.11.0"