Skip to content

Commit

Permalink
ci: add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
kencx committed Jul 13, 2022
1 parent db2fbfb commit 88745b8
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 16 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Test
name: CI

on:
push:
branches:
- master
tags:
- "v*"
pull_request:
branches:
- master
Expand Down Expand Up @@ -37,3 +39,28 @@ jobs:

- name: Run tests
run: make test


release:
needs: [test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
project_name: keyb
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- "arm64"
- "amd64"
- "386"
ldflags:
- "-s -w -X main.version={{ .Tag }}"
archives:
- name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format: tar.gz
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
changelog:
skip: true
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
binary = keyb
version = $(shell git describe --tags)
ldflags = -ldflags "-s -w"
ldflags = -ldflags "-s -w -X main.version=${version}"

.PHONY: help test clean snapshot build

Expand All @@ -18,6 +18,11 @@ test:
clean:
if [ -f ${binary} ]; then rm keyb; fi
go clean
rm -rf dist

## snapshot: generate unversioned snapshot release
snapshot:
goreleaser release --snapshot

## build: build binary
build:
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,17 @@ Prefixes are useful for applications with a common leading hotkey like tmux.
key: Super + Return

- name: tmux
prefix: ctrl + a
prefix: ctrl + b
keybinds:
- name: split vertical
key: "|"
- name: split horizontal
key: "-"
- name: {next, prev} window
key: shift + {>, <}
- name: Create new window
key: c
- name: Prev, next window
key: Shift + {←, →}
ignore_prefix: true
```
Refer to the defaults provided in `examples` for more details.
Refer to the defaults provided in `examples` for more details. Multiline fields
are not supported at the moment.

### Search

Expand Down Expand Up @@ -158,7 +157,7 @@ Both ANSI and hex color codes are supported.
## Similar Tools

- [showkeys](https://github.com/adamharmansky/showkeys) offers a keybinding popup similar to awesomewm
- [cheat](https://github.com/cheat/cheat) is a CLI tool to view cheatsheets for
- [cheat](https://github.com/cheat/cheat) is a CLI alternative to view cheatsheets for
commands and hotkeys for just about any topic
- Refer to [shortcut-pages](https://github.com/mt-empty/shortcut-pages), [cheat/cheatsheets](https://github.com/cheat/cheatsheets) for more cheatsheets

Expand Down
4 changes: 2 additions & 2 deletions examples/tmux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@
- name: "Transpose two letters (delete and paste)"
key: "[q]"
- name: "Move to the previous pane"
key: "[\\{]"
key: "[{]"
- name: "Move to the next pane"
key: "[\\}]"
key: "[}]"
- name: "Toggle between pane layouts"
key: "[Space]"
- name: "Resize pane (make taller)"
Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ const (
`
)

var (
version = "v0.1.0"
)
var version string

func main() {
log.SetPrefix("keyb: ")
Expand Down

0 comments on commit 88745b8

Please sign in to comment.