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
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Install cross-compilation dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Run GoReleaser for Linux
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean --config .goreleaser-linux.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-darwin:
runs-on: macos-latest
needs: release-linux
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Run GoReleaser for macOS
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean --config .goreleaser-darwin.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
panda
!.gitignore
!.github
!.goreleaser*
76 changes: 76 additions & 0 deletions .goreleaser-darwin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2

before:
hooks:
- go mod tidy
- go mod verify

builds:
- id: panda-darwin
main: ./main.go
binary: panda
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
- arm64
flags:
- -tags=fts5
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}

archives:
- id: panda-archive
format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
files:
- README.md
- LICENSE*

checksum:
name_template: 'checksums.txt'

snapshot:
version_template: "{{ incpatch .Version }}-next"

changelog:
sort: asc
use: github
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- '^chore:'
- Merge pull request
- Merge branch
groups:
- title: 'New Features'
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: 'Bug Fixes'
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: 'Other Changes'
order: 999

release:
github:
owner: aavshr
name: panda
draft: false
prerelease: auto
mode: append
name_template: "{{.ProjectName}} v{{.Version}}"
61 changes: 61 additions & 0 deletions .goreleaser-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2

before:
hooks:
- go mod tidy
- go mod verify

builds:
- id: panda-linux
main: ./main.go
binary: panda
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
- arm64
flags:
- -tags=fts5
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc

archives:
- id: panda-archive
format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
files:
- README.md
- LICENSE*

checksum:
name_template: 'checksums.txt'
disable: true

changelog:
disable: true

release:
github:
owner: aavshr
name: panda
draft: true
prerelease: auto
mode: append
name_template: "{{.ProjectName}} v{{.Version}}"
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import (
_ "embed"
"fmt"
"log"
"os"

"strings"

"github.com/aavshr/panda/internal/config"

Check failure on line 11 in main.go

View workflow job for this annotation

GitHub Actions / lint-build-test

could not import github.com/aavshr/panda/internal/config (-: cannot compile Go 1.23 code) (typecheck)
"github.com/aavshr/panda/internal/db"
"github.com/aavshr/panda/internal/llm/openai"
"github.com/aavshr/panda/internal/ui"
Expand All @@ -16,6 +17,13 @@
"golang.org/x/term"
)

// build information injected by goreleaser
var (
version = "dev"
commit = "none"
date = "unknown"
)

//go:embed internal/db/schema/init.sql
var dbSchemaInit string

Expand Down Expand Up @@ -76,6 +84,11 @@
}

func main() {
if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") {
fmt.Printf("panda %s\ncommit: %s\nbuilt at: %s\n", version, commit, date)
os.Exit(0)
}

isDev := strings.ToLower(os.Getenv("PANDA_ENV")) == "dev"
dataDirPath := config.GetDataDir()
databaseName := DefaultDatabaseName
Expand Down
Loading