diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..b051eef --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '1.20.x' + cache: true + - uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + # Custom secret here since we need to access to j178/homebrew-tap and j178/scoop-bucket repo. + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..992cba6 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,88 @@ +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + flags: + - -v + - -trimpath + ldflags: + - -s + - -w + +archives: + - format: tar.gz + rlcp: true + # this name template makes the OS and Arch compatible with the results of uname. + 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 }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + files: + - LICENSE* + - README* + - CHANGELOG* +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + use: github + groups: + - title: Features + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 0 + - title: 'Bug fixes' + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 1 + - title: Others + order: 999 + filters: + exclude: + - '^docs:' + - '^test:' + - '(?i)^Minor' +brews: +- tap: + owner: j178 + name: homebrew-tap + commit_author: + name: goreleaserbot + email: bot@goreleaser.com + homepage: https://github.com/j178/chatgpt + description: >- + A simple cli wrapper for ChatGPT API, powered by GPT-3.5-turbo model. + license: MIT + +scoop: + bucket: + owner: j178 + name: scoop-bucket + commit_author: + name: goreleaserbot + email: bot@goreleaser.com + folder: bucket + homepage: https://github.com/j178/chatgpt + description: >- + A simple cli wrapper for ChatGPT API, powered by GPT-3.5-turbo model. + license: MIT + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/README.md b/README.md index 0d6be55..8b0a282 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,25 @@ $ chatgpt ## Installation +You can download the latest binary from the [release page](https://github.com/j178/chatgpt/releases). + +### Install via go + +```shell +go install github.com/j178/chatgpt@latest +``` + +### Install via [HomeBrew](https://brew.sh/) on macOS/Linux + +```shell +brew install j178/tap/chatgpt +``` + +### Install via [Scoop](https://scoop.sh/) on Windows + ```shell -$ go install github.com/j178/chatgpt@latest +scoop bucket add j178 https://github.com/j178/scoop-bucket.git +scoop install j178/chatgpt ``` ## License