Skip to content

Commit a5f5032

Browse files
committed
ci: add goreleaser
1 parent 2e2c071 commit a5f5032

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

.github/workflows/go-releaser.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: ">=1.21.0"
23+
cache: true
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v6
26+
with:
27+
distribution: goreleaser
28+
version: "~> v2"
29+
args: release --clean --draft
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
debug.log
22
diffnav
3+
4+
dist/

.goreleaser.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
3+
4+
version: 2
5+
6+
before:
7+
hooks:
8+
# You may remove this if you don't use go modules.
9+
- go mod tidy
10+
11+
builds:
12+
- env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- linux
16+
- windows
17+
- darwin
18+
19+
archives:
20+
- format: tar.gz
21+
# this name template makes the OS and Arch compatible with the results of `uname`.
22+
name_template: >-
23+
{{ .ProjectName }}_
24+
{{- title .Os }}_
25+
{{- if eq .Arch "amd64" }}x86_64
26+
{{- else if eq .Arch "386" }}i386
27+
{{- else }}{{ .Arch }}{{ end }}
28+
{{- if .Arm }}v{{ .Arm }}{{ end }}
29+
# use zip for windows archives
30+
format_overrides:
31+
- goos: windows
32+
format: zip
33+
34+
changelog:
35+
sort: asc
36+
filters:
37+
exclude:
38+
- "^docs:"
39+
- "^test:"
40+
41+
brews:
42+
- name: diffnav
43+
44+
# NOTE: make sure the url_template, the token and given repo (github or
45+
# gitlab) owner and name are from the same kind.
46+
# We will probably unify this in the next major version like it is
47+
# done with scoop.
48+
49+
# URL which is determined by the given Token (github, gitlab or gitea).
50+
#
51+
# Default depends on the client.
52+
# Templates: allowed.
53+
url_template: "https://github.com/dlvhdr/diffnav/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
54+
55+
# Headers to include in the `url` stanza.
56+
# This can be a more modern alternative to `download_strategy` in some
57+
# cases.
58+
url_headers:
59+
- "Accept: application/octet-stream"
60+
- 'Authorization: bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}'
61+
62+
download_strategy: CurlDownloadStrategy
63+
64+
custom_require: custom_download_strategy
65+
66+
commit_author:
67+
name: goreleaserbot
68+
69+
70+
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
71+
72+
# Directory inside the repository to put the formula.
73+
directory: Formula
74+
75+
homepage: "https://github.com/dlvhdr/diffnav"
76+
77+
description: "A git diff pager based on delta but with a file tree, à la GitHub."
78+
79+
license: "MIT"
80+
81+
# Packages your package depends on.
82+
dependencies:
83+
- name: git
84+
- name: git-delta
85+
86+
# Repository to push the generated files to.
87+
repository:
88+
owner: dlvhdr
89+
name: homebrew-formulae
90+
branch: main

0 commit comments

Comments
 (0)