diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6efd4dd..f86b8bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,12 +22,22 @@ jobs: with: go-version: "1.25" + - name: Generate Release Notes + uses: orhun/git-cliff-action@v4 + with: + config: cliff.toml + args: --latest --strip header + env: + OUTPUT: release-notes.md + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v7 with: distribution: goreleaser version: "~> v2" - args: release --clean + args: release --clean --release-notes=release-notes.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 82867f2..f264279 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,6 +3,10 @@ version: 2 before: hooks: - go mod tidy + - mkdir -p completions + - sh -c 'go run main.go completion bash > completions/tmpo.bash' + - sh -c 'go run main.go completion zsh > completions/tmpo.zsh' + - sh -c 'go run main.go completion fish > completions/tmpo.fish' builds: # macOS (both Intel and Apple Silicon) @@ -44,7 +48,7 @@ builds: archives: - id: windows-zip - builds: [windows] + ids: [windows] name_template: >- {{ .ProjectName }}_ {{- .Version }}_ @@ -52,13 +56,16 @@ archives: {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} - format: zip + formats: [zip] files: - README.md - LICENSE + - completions/tmpo.bash + - completions/tmpo.zsh + - completions/tmpo.fish - id: unix-targz - builds: [macos, linux] + ids: [macos, linux] name_template: >- {{ .ProjectName }}_ {{- .Version }}_ @@ -66,10 +73,13 @@ archives: {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} - format: tar.gz + formats: [tar.gz] files: - README.md - LICENSE + - completions/tmpo.bash + - completions/tmpo.zsh + - completions/tmpo.fish checksum: name_template: 'checksums.txt' @@ -78,40 +88,6 @@ checksum: snapshot: version_template: "{{ incpatch .Version }}-next" -changelog: - sort: asc - groups: - - title: โœจ Features - regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' - order: 0 - - title: ๐Ÿ› Bug Fixes - regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' - order: 1 - - title: ๐Ÿš€ Performance Improvements - regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$' - order: 2 - - title: ๐Ÿ”จ Refactoring - regexp: '^.*?refactor(\([[:word:]]+\))??!?:.+$' - order: 3 - - title: ๐Ÿ“š Documentation - regexp: '^.*?docs?(\([[:word:]]+\))??!?:.+$' - order: 4 - - title: ๐Ÿ”ง Build & Dependencies - regexp: '^.*?(build|ci)(\([[:word:]]+\))??!?:.+$' - order: 5 - - title: ๐Ÿงน Maintenance - regexp: '^.*?chore(\([[:word:]]+\))??!?:.+$' - order: 6 - - title: ๐Ÿ“ฆ Other Changes - order: 999 - filters: - exclude: - - '^test:' - - Merge pull request - - Merge remote-tracking branch - - Merge branch - - go mod tidy - release: github: owner: DylanDevelops @@ -121,7 +97,7 @@ release: name_template: "tmpo {{.Version}}" # Homebrew -brews: +homebrew_casks: - name: tmpo repository: owner: DylanDevelops @@ -133,9 +109,7 @@ brews: homepage: "https://github.com/DylanDevelops/tmpo" description: "Minimal CLI time tracker for developers" license: "MIT" - skip_upload: false - install: | - bin.install "tmpo" - generate_completions_from_executable(bin/"tmpo", "completion") - test: | - system bin/"tmpo", "--version" + completions: + bash: "completions/tmpo.bash" + zsh: "completions/tmpo.zsh" + fish: "completions/tmpo.fish" diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..224301d --- /dev/null +++ b/cliff.toml @@ -0,0 +1,33 @@ +[changelog] +body = """ +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | striptags | trim }} +{% for commit in commits -%} +- {% if commit.breaking %}[breaking] {% endif %}{{ commit.message | split(pat="\\n") | first | upper_first }}{% if commit.remote.username %} by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}){% endif %} +{% endfor %} + +{% endfor %} +{% set new_contributors = github.contributors | filter(attribute="is_first_time", value=true) %} +{% if new_contributors | length > 0 %} +### ๐ŸŒŸ New Contributors +{% for contributor in new_contributors -%} +- [@{{ contributor.username }}](https://github.com/{{ contributor.username }}) made their first contribution! +{% endfor %} +{% endif %} +""" +trim = true + +[git] +conventional_commits = true +filter_unconventional = false +commit_parsers = [ + { message = "^feat", group = "โœจ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^perf", group = "๐Ÿš€ Performance Improvements" }, + { message = "^refactor", group = "๐Ÿ”จ Refactoring" }, + { message = "^docs?", group = "๐Ÿ“š Documentation" }, + { message = "^(build|ci)", group = "๐Ÿ”ง Build & Dependencies" }, + { message = "^chore", group = "๐Ÿงน Maintenance" }, + { message = "^Merge ", skip = true }, + { message = ".*", group = "๐Ÿ“ฆ Other Changes" }, +] \ No newline at end of file