Skip to content

Commit

Permalink
Adding goreleaser bits
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstinnett committed Jan 19, 2024
1 parent 10cde75 commit 3529dfe
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: goreleaser

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
TZ: "America/New_York"
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
-
name: Tests
run: |
go mod tidy
go test ./...
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.swp
diary.yaml*
places.yaml
dist/
completions/
58 changes: 58 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
before:
hooks:
- go mod tidy
- ./scripts/completions.sh
builds:
- env:
- CGO_ENABLED=0
main: ./cmd/letseat/
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- '-s -w'
- -X github.com/drewstinnett/letseat/cmd/letseat/cmd.date={{ .CommitTimestamp }}
- -X github.com/drewstinnett/letseat/cmd/letseat/cmd.version={{ .Tag }}
- -X github.com/drewstinnett/letseat/cmd/letseat/cmd.commit={{ .ShortCommit }}
flags:
- -trimpath
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: 'letseat'
archives:
- format: tar.gz
name_template: 'letseat-{{ .Version }}_{{ .Os }}_{{ .Arch }}'
files:
- completions/*
checksum:
name_template: 'letseat-{{ .Version }}_SHA256SUMS'
algorithm: sha256
snapshot:
name_template: "{{ .Tag }}-snapshot"
changelog:
skip: true
brews:
- name: 'letseat'
repository:
owner: drewstinnett
name: homebrew-letseat
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
description: "Figure out where to go for dinner!"
homepage: "https://github.com/drewstinnett/letseat"
license: BSD-2-Clause
caveats: |
Add the following in your ~/.zshrc or ~/.profile for faster typin':
alias tp="#{opt_bin}/letseat"
install: |-
bin.install "letseat"
bash_completion.install "completions/letseat.bash" => "letseat"
zsh_completion.install "completions/letseat.zsh" => "_letseat"
fish_completion.install "completions/letseat.fish"
7 changes: 7 additions & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
rm -rf completions
mkdir completions
for sh in bash zsh fish; do
go run ./cmd/letseat completion "$sh" >"completions/letseat.$sh"
done

0 comments on commit 3529dfe

Please sign in to comment.