diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..207b8bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Unshallow + run: git fetch --prune --unshallow + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.20.x + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..147cd8e --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,46 @@ +before: + hooks: + - go get golang.org/x/tools/cmd/goyacc + - go yacc -o filter_parser.go filter_parser.y + - rm y.output + - go mod download +builds: +- binary: todoist + goos: + - darwin + - linux + - windows + goarch: + - 386 + - amd64 + - arm + - arm64 + ldflags: + - -s -w -X main.version={{.Version}} +archives: + - id: replace + name_template: >- + {{- .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end -}} +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +brews: +- tap: + owner: sachaos + name: homebrew-todoist + folder: Formula + homepage: https://github.com/sachaos/todoist + description: Todoist CLI client + skip_upload: auto diff --git a/main.go b/main.go index 3fc9175..a2a65c3 100644 --- a/main.go +++ b/main.go @@ -13,12 +13,13 @@ import ( "github.com/fatih/color" "github.com/rkoesters/xdg/basedir" - "github.com/sachaos/todoist/lib" + todoist "github.com/sachaos/todoist/lib" "github.com/spf13/viper" "github.com/urfave/cli/v2" ) var ( + version string homePath, _ = os.UserHomeDir() configPath = filepath.Join(basedir.ConfigHome, "todoist") cachePath = filepath.Join(basedir.CacheHome, "todoist", "cache.json") @@ -42,7 +43,7 @@ func main() { app := cli.NewApp() app.Name = "todoist" app.Usage = "Todoist CLI Client" - app.Version = "0.20.0" + app.Version = version app.EnableBashCompletion = true contentFlag := cli.StringFlag{