Skip to content

Commit a84d90d

Browse files
authored
Merge pull request #1 from chuksgpfr/chuks/deploy
Chuks/deploy
2 parents 95e65d0 + 38b28ee commit a84d90d

6 files changed

Lines changed: 216 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.22"
22+
23+
- name: Cache Go modules
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/go/pkg/mod
28+
~/.cache/go-build
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
32+
33+
- name: Run tests
34+
run: go test ./...

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write # needed to create tags & releases
10+
id-token: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: "1.22"
26+
27+
- name: Cache Go modules
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/go/pkg/mod
32+
~/.cache/go-build
33+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
34+
restore-keys: |
35+
${{ runner.os }}-go-
36+
37+
- name: Determine next tag
38+
id: tag
39+
run: |
40+
# Get latest tag or default to v0.0.0
41+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
42+
echo "Last tag: $LAST_TAG"
43+
44+
# Strip the leading v
45+
VERSION=${LAST_TAG#v}
46+
47+
MAJOR=$(echo "$VERSION" | cut -d. -f1)
48+
MINOR=$(echo "$VERSION" | cut -d. -f2)
49+
PATCH=$(echo "$VERSION" | cut -d. -f3)
50+
51+
# bump patch by default; you can change this logic later
52+
PATCH=$((PATCH + 1))
53+
54+
NEXT_TAG="v${MAJOR}.${MINOR}.${PATCH}"
55+
echo "Next tag: $NEXT_TAG"
56+
57+
echo "next_tag=$NEXT_TAG" >> $GITHUB_OUTPUT
58+
59+
- name: Create tag
60+
run: |
61+
NEXT_TAG="${{ steps.tag.outputs.next_tag }}"
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
65+
git tag "$NEXT_TAG"
66+
git push origin "$NEXT_TAG"
67+
68+
- name: Set LDFLAGS env
69+
run: |
70+
VERSION="${{ steps.tag.outputs.next_tag }}"
71+
COMMIT="$(git rev-parse --short HEAD)"
72+
DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
73+
echo "LDFLAGS=-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" >> $GITHUB_ENV
74+
75+
- name: Run GoReleaser
76+
uses: goreleaser/goreleaser-action@v6
77+
with:
78+
version: latest
79+
args: release --clean
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
LDFLAGS: ${{ env.LDFLAGS }}

.goreleaser.yaml

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,71 @@ before:
1616
- go generate ./...
1717

1818
builds:
19-
- env:
20-
- CGO_ENABLED=0
19+
- id: linux-amd64
20+
binary: zing-{{ .Os }}-{{ .Arch }}
21+
# main: ./main.go
2122
goos:
2223
- linux
23-
- windows
24+
goarch:
25+
- amd64
26+
# ldflags:
27+
# - "{{ .Env.LDFLAGS }}"
28+
no_unique_dist_dir: true
29+
30+
- id: darwin-amd64
31+
binary: zing-{{ .Os }}-{{ .Arch }}
32+
# main: ./main.go
33+
goos:
2434
- darwin
35+
goarch:
36+
- amd64
37+
# ldflags:
38+
# - "{{ .Env.LDFLAGS }}"
39+
no_unique_dist_dir: true
40+
- id: darwin-arm64
41+
binary: zing-{{ .Os }}-{{ .Arch }}
42+
# main: ./main.go
43+
goos:
44+
- darwin
45+
goarch:
46+
- arm64 # M1, M2, M3, M4 all use this
47+
# ldflags:
48+
# - "{{ .Env.LDFLAGS }}"
49+
no_unique_dist_dir: true
50+
51+
- id: windows-amd64
52+
binary: zing-{{ .Os }}-{{ .Arch }}
53+
# main: ./main.go
54+
goos:
55+
- windows
56+
goarch:
57+
- amd64
58+
# ldflags:
59+
# - -buildmode=exe
60+
# - "{{ .Env.LDFLAGS }}"
61+
no_unique_dist_dir: true
62+
# builds:
63+
# - env:
64+
# - CGO_ENABLED=0
65+
# goos:
66+
# - linux
67+
# - windows
68+
# - darwin
2569

26-
archives:
27-
- formats: [tar.gz]
28-
# this name template makes the OS and Arch compatible with the results of `uname`.
29-
name_template: >-
30-
{{ .ProjectName }}_
31-
{{- title .Os }}_
32-
{{- if eq .Arch "amd64" }}x86_64
33-
{{- else if eq .Arch "386" }}i386
34-
{{- else }}{{ .Arch }}{{ end }}
35-
{{- if .Arm }}v{{ .Arm }}{{ end }}
36-
# use zip for windows archives
37-
format_overrides:
38-
- goos: windows
39-
formats: [zip]
70+
# archives:
71+
# - formats: [tar.gz]
72+
# # this name template makes the OS and Arch compatible with the results of `uname`.
73+
# name_template: >-
74+
# {{ .ProjectName }}_
75+
# {{- title .Os }}_
76+
# {{- if eq .Arch "amd64" }}x86_64
77+
# {{- else if eq .Arch "386" }}i386
78+
# {{- else }}{{ .Arch }}{{ end }}
79+
# {{- if .Arm }}v{{ .Arm }}{{ end }}
80+
# # use zip for windows archives
81+
# format_overrides:
82+
# - goos: windows
83+
# formats: [zip]
4084

4185
changelog:
4286
sort: asc
@@ -51,3 +95,24 @@ release:
5195
---
5296
5397
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
98+
99+
100+
homebrew_casks:
101+
- name: zing # cask name (defaults to project_name if omitted)
102+
binaries:
103+
- zing # binary name inside the archive
104+
105+
description: "Zing helps developers zing through repetitive commands."
106+
homepage: "https://github.com/chuksgpfr/zing"
107+
108+
# Where to put the generated cask file in *this same* repo
109+
directory: Casks
110+
111+
# Commit the cask to github.com/chuksgpfr/zing
112+
repository:
113+
owner: chuksgpfr
114+
name: zing
115+
116+
commit_author:
117+
name: "Zing Bot"
118+
email: "chuksgpfr+zingbot@gmail.com"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ Automate your most frequent CLI workflows with human-friendly aliases, templates
3535
### Install (Go example)
3636
- MacOS
3737
```bash
38-
brew install --cask chuksgpfr/zing
38+
brew tap zing https://github.com/chuksgpfr/zing
39+
brew install --cask zing
3940
```
4041

4142
- Go

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ module github.com/chuksgpfr/zing
22

33
go 1.23.0
44

5-
require github.com/fatih/color v1.18.0
5+
require (
6+
github.com/dgraph-io/badger/v4 v4.8.0
7+
github.com/fatih/color v1.18.0
8+
github.com/spf13/cobra v1.10.1
9+
)
610

711
require (
812
github.com/cespare/xxhash/v2 v2.3.0 // indirect
9-
github.com/dgraph-io/badger/v4 v4.8.0 // indirect
1013
github.com/dgraph-io/ristretto/v2 v2.2.0 // indirect
1114
github.com/dustin/go-humanize v1.0.1 // indirect
1215
github.com/go-logr/logr v1.4.3 // indirect
@@ -16,7 +19,6 @@ require (
1619
github.com/klauspost/compress v1.18.0 // indirect
1720
github.com/mattn/go-colorable v0.1.13 // indirect
1821
github.com/mattn/go-isatty v0.0.20 // indirect
19-
github.com/spf13/cobra v1.10.1 // indirect
2022
github.com/spf13/pflag v1.0.10 // indirect
2123
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
2224
go.opentelemetry.io/otel v1.37.0 // indirect

go.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
22
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
33
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
4+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
46
github.com/dgraph-io/badger/v4 v4.8.0 h1:JYph1ChBijCw8SLeybvPINizbDKWZ5n/GYbz2yhN/bs=
57
github.com/dgraph-io/badger/v4 v4.8.0/go.mod h1:U6on6e8k/RTbUWxqKR0MvugJuVmkxSNc79ap4917h4w=
68
github.com/dgraph-io/ristretto/v2 v2.2.0 h1:bkY3XzJcXoMuELV8F+vS8kzNgicwQFAaGINAEJdWGOM=
79
github.com/dgraph-io/ristretto/v2 v2.2.0/go.mod h1:RZrm63UmcBAaYWC1DotLYBmTvgkrs0+XhBd7Npn7/zI=
10+
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38=
11+
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
812
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
913
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
1014
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
@@ -16,6 +20,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
1620
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
1721
github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q=
1822
github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
23+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
24+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
1925
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
2026
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
2127
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
@@ -25,12 +31,16 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
2531
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
2632
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
2733
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
34+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
35+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2836
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
2937
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
3038
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
3139
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
3240
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
3341
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
42+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
43+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
3444
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
3545
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
3646
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
@@ -48,4 +58,5 @@ golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
4858
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
4959
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
5060
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
61+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
5162
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)