Skip to content

Commit

Permalink
chore: add goreleaser and release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Mar 4, 2023
1 parent 97be8c2 commit e67f564
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
88 changes: 88 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
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: [email protected]
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
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e67f564

Please sign in to comment.