Skip to content

Commit

Permalink
ci: add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
dlvhdr committed Sep 24, 2024
1 parent 2e2c071 commit a5f5032
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: goreleaser

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
debug.log
diffnav

dist/
90 changes: 90 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# 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

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

brews:
- name: diffnav

# NOTE: make sure the url_template, the token and given repo (github or
# gitlab) owner and name are from the same kind.
# We will probably unify this in the next major version like it is
# done with scoop.

# URL which is determined by the given Token (github, gitlab or gitea).
#
# Default depends on the client.
# Templates: allowed.
url_template: "https://github.com/dlvhdr/diffnav/releases/download/{{ .Tag }}/{{ .ArtifactName }}"

# Headers to include in the `url` stanza.
# This can be a more modern alternative to `download_strategy` in some
# cases.
url_headers:
- "Accept: application/octet-stream"
- 'Authorization: bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}'

download_strategy: CurlDownloadStrategy

custom_require: custom_download_strategy

commit_author:
name: goreleaserbot
email: [email protected]

commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"

# Directory inside the repository to put the formula.
directory: Formula

homepage: "https://github.com/dlvhdr/diffnav"

description: "A git diff pager based on delta but with a file tree, à la GitHub."

license: "MIT"

# Packages your package depends on.
dependencies:
- name: git
- name: git-delta

# Repository to push the generated files to.
repository:
owner: dlvhdr
name: homebrew-formulae
branch: main

0 comments on commit a5f5032

Please sign in to comment.