Skip to content

Commit d8178c0

Browse files
Merge pull request #21 from merschformann/merschformann/go-releaser
Adds homebrew support
2 parents ea0701f + 70cdc56 commit d8178c0

File tree

13 files changed

+369
-318
lines changed

13 files changed

+369
-318
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ name: build
22
on: [push]
33

44
jobs:
5-
build:
6-
name: build
7-
runs-on: ubuntu-latest
8-
steps:
9-
- name: git clone
10-
uses: actions/checkout@v4
5+
build:
6+
name: build
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: git clone
10+
uses: actions/checkout@v4
1111

12-
- name: set up go
13-
uses: actions/setup-go@v5
14-
with:
15-
go-version: 1.23.4
12+
- name: set up go
13+
uses: actions/setup-go@v5
14+
with:
15+
go-version: 1.24.0
1616

17-
- name: go build
18-
run: go build -v
17+
- name: go build
18+
run: go build -v
1919

20-
- name: go test
21-
run: go test -v -cover -coverpkg=./... -race ./...
20+
- name: go test
21+
run: go test -v -cover -coverpkg=./... -race ./...
2222

23-
- name: golangci-lint
24-
uses: golangci/golangci-lint-action@v3
25-
with:
26-
version: v1.63.4
23+
- name: golangci-lint
24+
uses: golangci/golangci-lint-action@v3
25+
with:
26+
version: v1.63.4

.github/workflows/publish.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
name: publish
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
610

711
jobs:
8-
deploy:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: git clone
12-
uses: actions/checkout@v4
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
1317

14-
- name: set up go
15-
uses: actions/setup-go@v5
16-
with:
17-
go-version: 1.23.4
18+
- name: Unshallow repo
19+
run: git fetch --prune --unshallow
1820

19-
- name: compile
20-
run: |
21-
echo "go version:"
22-
go version
23-
echo "go env:"
24-
go env
25-
bash material/scripts/buildall.sh
21+
- name: Setup Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: 1.24.x
2625

27-
- name: Upload binaries to release
28-
uses: svenstaro/upload-release-action@v2
29-
with:
30-
repo_token: ${{ secrets.GITHUB_TOKEN }}
31-
file: build/gotz*
32-
file_glob: true
33-
tag: ${{ github.ref }}
34-
overwrite: true
35-
body: "gotz binaries"
26+
- name: Run goreleaser
27+
uses: goreleaser/goreleaser-action@v4
28+
with:
29+
distribution: goreleaser
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
BREW_TOKEN: ${{ secrets.BREW_BUMP_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
gotz
22
gotz.exe
33
build/
4+
dist/

.goreleaser.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
builds:
2+
- env:
3+
- CGO_ENABLED=0
4+
goos:
5+
- freebsd
6+
- windows
7+
- darwin
8+
- linux
9+
goarch:
10+
- amd64
11+
- arm
12+
- arm64
13+
- "386"
14+
ldflags:
15+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
16+
checksum:
17+
name_template: "checksums.txt"
18+
changelog:
19+
use: github-native
20+
sort: asc
21+
brews:
22+
- name: gotz
23+
homepage: "https://github.com/merschformann/gotz"
24+
description: "A simple CLI timezone conversion assistant, written in Go"
25+
repository:
26+
owner: merschformann
27+
name: gotz-brew
28+
token: "{{ .Env.BREW_TOKEN }}"
29+
commit_author:
30+
name: merschbotmann
31+
email: bot.merschformann@gmail.com

.prettierrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tabWidth: 2

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func main() {
3131
}
3232
}
3333
// Parse flags
34-
config, rt, changed, err := core.ParseFlags(config, Version)
34+
config, rt, changed, err := core.ParseFlags(config, GetReleaseInfo().Version)
3535
if err != nil {
3636
fmt.Println("error parsing flags:", err)
3737
os.Exit(1)

tests/testdata/static_default.json

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
{
2-
"config_version": "1.0",
3-
"timezones": [
4-
{
5-
"Name": "New York",
6-
"TZ": "America/New_York"
7-
},
8-
{
9-
"Name": "Berlin",
10-
"TZ": "Europe/Berlin"
11-
},
12-
{
13-
"Name": "Shanghai",
14-
"TZ": "Asia/Shanghai"
15-
},
16-
{
17-
"Name": "Sydney",
18-
"TZ": "Australia/Sydney"
19-
}
20-
],
21-
"style": {
22-
"symbols": "rectangles",
23-
"colorize": false,
24-
"day_segments": {
25-
"morning": 6,
26-
"day": 8,
27-
"evening": 18,
28-
"night": 22
29-
},
30-
"coloring": {
31-
"StaticColorMorning": "red",
32-
"StaticColorDay": "yellow",
33-
"StaticColorEvening": "red",
34-
"StaticColorNight": "blue",
35-
"StaticColorForeground": "",
36-
"DynamicColorMorning": "red",
37-
"DynamicColorDay": "yellow",
38-
"DynamicColorEvening": "red",
39-
"DynamicColorNight": "blue",
40-
"DynamicColorForeground": "",
41-
"DynamicColorBackground": ""
42-
}
2+
"config_version": "1.0",
3+
"timezones": [
4+
{
5+
"Name": "New York",
6+
"TZ": "America/New_York"
437
},
44-
"tics": false,
45-
"stretch": true,
46-
"hours12": false,
47-
"live": false
8+
{
9+
"Name": "Berlin",
10+
"TZ": "Europe/Berlin"
11+
},
12+
{
13+
"Name": "Shanghai",
14+
"TZ": "Asia/Shanghai"
15+
},
16+
{
17+
"Name": "Sydney",
18+
"TZ": "Australia/Sydney"
19+
}
20+
],
21+
"style": {
22+
"symbols": "rectangles",
23+
"colorize": false,
24+
"day_segments": {
25+
"morning": 6,
26+
"day": 8,
27+
"evening": 18,
28+
"night": 22
29+
},
30+
"coloring": {
31+
"StaticColorMorning": "red",
32+
"StaticColorDay": "yellow",
33+
"StaticColorEvening": "red",
34+
"StaticColorNight": "blue",
35+
"StaticColorForeground": "",
36+
"DynamicColorMorning": "red",
37+
"DynamicColorDay": "yellow",
38+
"DynamicColorEvening": "red",
39+
"DynamicColorNight": "blue",
40+
"DynamicColorForeground": "",
41+
"DynamicColorBackground": ""
42+
}
43+
},
44+
"tics": false,
45+
"stretch": true,
46+
"hours12": false,
47+
"live": false
4848
}

tests/testdata/static_hours12.json

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
{
2-
"config_version": "1.0",
3-
"timezones": [
4-
{
5-
"Name": "New York",
6-
"TZ": "America/New_York"
7-
},
8-
{
9-
"Name": "Berlin",
10-
"TZ": "Europe/Berlin"
11-
},
12-
{
13-
"Name": "Shanghai",
14-
"TZ": "Asia/Shanghai"
15-
},
16-
{
17-
"Name": "Sydney",
18-
"TZ": "Australia/Sydney"
19-
}
20-
],
21-
"style": {
22-
"symbols": "rectangles",
23-
"colorize": false,
24-
"day_segments": {
25-
"morning": 6,
26-
"day": 8,
27-
"evening": 18,
28-
"night": 22
29-
},
30-
"coloring": {
31-
"StaticColorMorning": "red",
32-
"StaticColorDay": "yellow",
33-
"StaticColorEvening": "red",
34-
"StaticColorNight": "blue",
35-
"StaticColorForeground": "",
36-
"DynamicColorMorning": "red",
37-
"DynamicColorDay": "yellow",
38-
"DynamicColorEvening": "red",
39-
"DynamicColorNight": "blue",
40-
"DynamicColorForeground": "",
41-
"DynamicColorBackground": ""
42-
}
2+
"config_version": "1.0",
3+
"timezones": [
4+
{
5+
"Name": "New York",
6+
"TZ": "America/New_York"
437
},
44-
"tics": false,
45-
"stretch": true,
46-
"hours12": true,
47-
"live": false
8+
{
9+
"Name": "Berlin",
10+
"TZ": "Europe/Berlin"
11+
},
12+
{
13+
"Name": "Shanghai",
14+
"TZ": "Asia/Shanghai"
15+
},
16+
{
17+
"Name": "Sydney",
18+
"TZ": "Australia/Sydney"
19+
}
20+
],
21+
"style": {
22+
"symbols": "rectangles",
23+
"colorize": false,
24+
"day_segments": {
25+
"morning": 6,
26+
"day": 8,
27+
"evening": 18,
28+
"night": 22
29+
},
30+
"coloring": {
31+
"StaticColorMorning": "red",
32+
"StaticColorDay": "yellow",
33+
"StaticColorEvening": "red",
34+
"StaticColorNight": "blue",
35+
"StaticColorForeground": "",
36+
"DynamicColorMorning": "red",
37+
"DynamicColorDay": "yellow",
38+
"DynamicColorEvening": "red",
39+
"DynamicColorNight": "blue",
40+
"DynamicColorForeground": "",
41+
"DynamicColorBackground": ""
42+
}
43+
},
44+
"tics": false,
45+
"stretch": true,
46+
"hours12": true,
47+
"live": false
4848
}

0 commit comments

Comments
 (0)