diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..81bd942 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: goreleaser + +on: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v5 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + # 'latest', 'nightly', or a semver + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4094b76..e6455bb 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -6,7 +6,7 @@ # yaml-language-server: $schema=https://goreleaser.com/static/schema.json # vim: set ts=2 sw=2 tw=0 fo=cnqoj -version: 1 +version: 2 before: hooks: @@ -44,3 +44,12 @@ changelog: exclude: - "^docs:" - "^test:" +brews: + - + name: lazysql + homepage: https://github.com/jorgerojas26/lazysql + repository: + owner: jorgerojas26 + name: homebrew-lazysql + test: | + system "#{bin}/lazysql version" diff --git a/README.md b/README.md index ef238c7..409fbc0 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,12 @@ I use Lazysql daily in my ful time job as a fullstack javascript developer in it ### Installation -#### Binary Releases +#### Homebrew -For Windows, Mac OS or Linux, you can download a binary release [here](https://github.com/jorgerojas26/lazysql/releases) +```bash +brew tap jorgerojas26/lazysql +brew install lazysql +``` #### Install with go package manager @@ -95,7 +98,11 @@ For Windows, Mac OS or Linux, you can download a binary release [here](https://g go install github.com/jorgerojas26/lazysql@latest ``` -#### Install from package manager +#### Binary Releases + +For Windows, Mac OS or Linux, you can download a binary release [here](https://github.com/jorgerojas26/lazysql/releases) + +#### Third party (maintained by the community) Archlinux users can install it from the AUR with: diff --git a/main.go b/main.go index 25f3a34..ae1c7cc 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "io" "log" + "os" "github.com/jorgerojas26/lazysql/app" "github.com/jorgerojas26/lazysql/components" @@ -10,9 +11,22 @@ import ( "github.com/go-sql-driver/mysql" ) +var version = "dev" + func main() { mysql.SetLogger(log.New(io.Discard, "", 0)) + // check if "version" arg is passed + argsWithProg := os.Args + + if len(argsWithProg) > 1 { + switch argsWithProg[1] { + case "version": + println("LazySQL version: ", version) + os.Exit(0) + } + } + if err := app.App. SetRoot(components.MainPages, true). EnableMouse(true).