Skip to content

Commit bf4cec1

Browse files
committed
fixed versioning
1 parent cbeba03 commit bf4cec1

File tree

5 files changed

+146
-5
lines changed

5 files changed

+146
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.idea
1+
.idea

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ It is easy to open your [/etc/hosts] file in text editor and add or remove entri
1212

1313
**txeh** was initially built as a golang library to support [kubefwd](https://github.com/txn2/kubefwd), a Kubernetes port-forwarding utility utilizing [/etc/hosts] heavily, to associate custom hostnames with multiple local loopback IP addresses and remove these entries when it terminates.
1414

15-
A computer's [/etc/hosts] file is a powerful utility for developers and system administrators to create localized, custom DNS entries. This small go library and utility were developed to encapsulate the complexity of working with /etc/hosts by providing a simple interface for adding and removing entries in a [/etc/hosts] file.
15+
A computer's [/etc/hosts] file is a powerful utility for developers and system administrators to create localized, custom DNS entries. This small go library and utility were developed to encapsulate the complexity of working with [/etc/hosts] directly by providing a simple interface for adding and removing entries in a [/etc/hosts] file.
1616

1717
## txeh Utility
1818

@@ -110,4 +110,20 @@ func main() {
110110

111111
```
112112

113+
## Build Release
114+
115+
Build test release:
116+
```bash
117+
goreleaser --skip-publish --rm-dist --skip-validate
118+
```
119+
120+
Build and release:
121+
```bash
122+
GITHUB_TOKEN=$GITHUB_TOKEN goreleaser --rm-dist
123+
```
124+
125+
### License
126+
127+
Apache License 2.0
128+
113129
[/etc/hosts]:https://en.wikipedia.org/wiki/Hosts_(file)

goreleaser.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Build customization
2+
build:
3+
# Path to main.go file.
4+
# Default is `main.go`
5+
main: ./util/txeh.go
6+
binary: txeh
7+
8+
env:
9+
- CGO_ENABLED=0
10+
11+
# GOOS list to build in.
12+
# For more info refer to https://golang.org/doc/install/source#environment
13+
# Defaults are darwin and linux
14+
goos:
15+
- linux
16+
- darwin
17+
- arm
18+
- windows
19+
20+
# GOARCH to build in.
21+
# For more info refer to https://golang.org/doc/install/source#environment
22+
# Defaults are 386 and amd64
23+
goarch:
24+
- amd64
25+
- arm
26+
27+
ldflags: -s -w -X cmd.Version={{.Version}}
28+
29+
release:
30+
# Repo in which the release will be created.
31+
# Default is extracted from the origin remote URL.
32+
github:
33+
owner: txn2
34+
name: txeh
35+
36+
# If set to true, will not auto-publish the release.
37+
# Default is false.
38+
draft: false
39+
40+
# If set to true, will mark the release as not ready for production.
41+
# Default is false.
42+
prerelease: false
43+
44+
# You can change the name of the GitHub release.
45+
# Default is ``
46+
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
47+
48+
# You can disable this pipe in order to not upload any artifacts to
49+
# GitHub.
50+
# Defaults to false.
51+
disable: false
52+
53+
nfpm:
54+
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
55+
homepage: https://github.com/txn2/txeh
56+
description: Etc Hosts Management Utility.
57+
maintainer: Craig Johnston <cjimti@gmail.com>
58+
license: Apache 2.0
59+
vendor: TXN2
60+
formats:
61+
- deb
62+
- rpm
63+
recommends:
64+
- rpm
65+
66+
# Archive customization
67+
archive:
68+
# You can change the name of the archive.
69+
# This is parsed with Golang template engine and the following variables.
70+
name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"
71+
72+
# Archive format. Valid options are `tar.gz` and `zip`.
73+
# Default is `zip`
74+
format: tar.gz
75+
76+
# Replacements for GOOS and GOARCH on the archive name.
77+
# The keys should be valid GOOS or GOARCH values followed by your custom
78+
# replacements.
79+
# By default, `replacements` replace GOOS and GOARCH values with valid outputs
80+
# of `uname -s` and `uname -m` respectively.
81+
replacements:
82+
amd64: amd64
83+
386: 386
84+
darwin: macOS
85+
linux: linux
86+
87+
format_overrides:
88+
- goos: windows
89+
format: zip
90+
91+
# Additional files you want to add to the archive.
92+
# Defaults are any files matching `LICENCE*`, `LICENSE*`,
93+
# `README*` and `CHANGELOG*` (case-insensitive)
94+
files:
95+
- LICENSE
96+
97+
brew:
98+
name: txeh
99+
100+
github:
101+
owner: txn2
102+
name: homebrew-tap
103+
104+
commit_author:
105+
name: Craig Johnston
106+
email: cjimti@gmail.com
107+
108+
folder: Formula
109+
110+
homepage: https://github.com/txn2/txeh
111+
112+
description: "Etc Hosts Management Utility."
113+
114+
skip_upload: false
115+
116+
test: |-
117+
txeh version
118+
119+
snapcraft:
120+
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
121+
summary: Etc Hosts Management Utility.
122+
description: |
123+
Kubernetes bulk port forwarding utility.
124+
grade: stable
125+
confinement: classic

util/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var rootCmd = &cobra.Command{
1717
| |___ _____| |__
1818
| __\ \/ / _ \ '_ \
1919
| |_ > < __/ | | |
20-
\__/_/\_\___|_| |_| v` + VERSION + `
20+
\__/_/\_\___|_| |_| v` + Version + `
2121
2222
Add, remove and re-associate hostname entries in your /etc/hosts file.
2323
Read more including useage as a Go library at https://github.com/txn2/txeh`,

util/cmd/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
const VERSION = "0.0.0"
9+
var Version = "0.0.0"
1010

1111
func init() {
1212
rootCmd.AddCommand(versionCmd)
@@ -17,6 +17,6 @@ var versionCmd = &cobra.Command{
1717
Short: "Print the version number of txeh",
1818
Long: ``,
1919
Run: func(cmd *cobra.Command, args []string) {
20-
fmt.Printf("txeh Version %s", VERSION)
20+
fmt.Printf("txeh Version %s\n", Version)
2121
},
2222
}

0 commit comments

Comments
 (0)