Skip to content

Commit c68d7ce

Browse files
authored
feat: add version, completion, notarize for mac (#4)
1 parent 1e5fdd0 commit c68d7ce

11 files changed

Lines changed: 970 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ jobs:
3636
env:
3737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3838
HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
39+
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
40+
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
41+
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
42+
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
43+
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
.bin
1+
.bin
2+
3+
# goreleaser output directory
4+
dist
5+
6+
# secret files
7+
secret

.goreleaser.yaml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33

44
version: 2
55

6-
before:
7-
hooks:
8-
- go mod tidy
9-
- go generate ./...
6+
notarize:
7+
macos:
8+
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'
9+
ids:
10+
- onekeymap-cli
11+
sign:
12+
certificate: "{{.Env.MACOS_SIGN_P12}}"
13+
password: "{{.Env.MACOS_SIGN_PASSWORD}}"
14+
15+
notarize:
16+
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
17+
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
18+
key: "{{.Env.MACOS_NOTARY_KEY}}"
19+
wait: true
20+
timeout: 10m
1021

1122
builds:
1223
- id: onekeymap-cli
@@ -23,9 +34,7 @@ builds:
2334
- arm64
2435
ldflags:
2536
- -s -w
26-
- -X main.version={{.Version}}
27-
- -X main.commit={{.Commit}}
28-
- -X main.date={{.Date}}
37+
- -X github.com/xinnjie/onekeymap-cli/internal/cmd/version={{.Version}}
2938

3039
archives:
3140
- id: onekeymap-cli
@@ -37,7 +46,9 @@ archives:
3746
{{- else }}{{ .Arch }}{{ end }}
3847
{{- if .Arm }}v{{ .Arm }}{{ end }}
3948
files:
40-
- LICENSE*
49+
- README.md
50+
- LICENSE.md
51+
- completions/*
4152

4253
checksum:
4354
name_template: 'checksums.txt'
@@ -89,8 +100,12 @@ homebrew_casks:
89100
homepage: https://github.com/xinnjie/homebrew-onekeymap
90101
description: "Universal keymap configuration tool for VSCode, Zed, IntelliJ and more"
91102
binary: onekeymap-cli
103+
completions:
104+
bash: completions/onekeymap-cli.bash
105+
zsh: completions/onekeymap-cli.zsh
106+
fish: completions/onekeymap-cli.fish
92107

93108
# generate universal binaries for osx, see https://goreleaser.com/customization/universalbinaries/
94109
universal_binaries:
95110
- replace: true
96-
name_template: 'onekeymap-cli'
111+
name_template: 'onekeymap-cli'

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Doc: https://pre-commit.com/#pre-commit-configyaml---hooks
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v5.0.0
5+
hooks:
6+
- id: trailing-whitespace
7+
exclude: |
8+
(?x)^(
9+
protogen/.*
10+
)$
11+
- id: end-of-file-fixer
12+
exclude: |
13+
(?x)^(
14+
protogen/.*
15+
)$
16+
- id: check-added-large-files
17+
- id: forbid-submodules
18+
- repo: local
19+
hooks:
20+
# Go
21+
- id: golangci-lint
22+
name: "Run golangci lint"
23+
entry: golangci-lint
24+
args: ["run", "--fix", "--config", ".golangci.yaml"]
25+
language: system
26+
pass_filenames: false
27+
- id: go-fmt
28+
name: "Run go fmt"
29+
entry: go
30+
args: ["fmt", "./..."]
31+
language: system
32+
types: [go]
33+
pass_filenames: false

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Xinjie Ge
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ build:
1010
lipo -create -output .bin/onekeymap-cli .bin/onekeymap-cli-arm64 .bin/onekeymap-cli-amd64
1111
rm .bin/onekeymap-cli-arm64 .bin/onekeymap-cli-amd64
1212
./.bin/onekeymap-cli dev docSupportActions &> ./action-support-matrix.md
13+
mkdir -p completions
14+
./.bin/onekeymap-cli completion bash > completions/onekeymap-cli.bash
15+
./.bin/onekeymap-cli completion zsh > completions/onekeymap-cli.zsh
16+
./.bin/onekeymap-cli completion fish > completions/onekeymap-cli.fish
1317

1418
format:
1519
@$(GO_ENV) go fmt ./...

README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)