Skip to content

Commit

Permalink
fixed versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
cjimti committed Feb 16, 2019
1 parent cbeba03 commit bf4cec1
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.idea
.idea
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It is easy to open your [/etc/hosts] file in text editor and add or remove entri

**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.

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.
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.

## txeh Utility

Expand Down Expand Up @@ -110,4 +110,20 @@ func main() {

```

## Build Release

Build test release:
```bash
goreleaser --skip-publish --rm-dist --skip-validate
```

Build and release:
```bash
GITHUB_TOKEN=$GITHUB_TOKEN goreleaser --rm-dist
```

### License

Apache License 2.0

[/etc/hosts]:https://en.wikipedia.org/wiki/Hosts_(file)
125 changes: 125 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Build customization
build:
# Path to main.go file.
# Default is `main.go`
main: ./util/txeh.go
binary: txeh

env:
- CGO_ENABLED=0

# GOOS list to build in.
# For more info refer to https://golang.org/doc/install/source#environment
# Defaults are darwin and linux
goos:
- linux
- darwin
- arm
- windows

# GOARCH to build in.
# For more info refer to https://golang.org/doc/install/source#environment
# Defaults are 386 and amd64
goarch:
- amd64
- arm

ldflags: -s -w -X cmd.Version={{.Version}}

release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL.
github:
owner: txn2
name: txeh

# If set to true, will not auto-publish the release.
# Default is false.
draft: false

# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: false

# You can change the name of the GitHub release.
# Default is ``
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"

# You can disable this pipe in order to not upload any artifacts to
# GitHub.
# Defaults to false.
disable: false

nfpm:
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
homepage: https://github.com/txn2/txeh
description: Etc Hosts Management Utility.
maintainer: Craig Johnston <[email protected]>
license: Apache 2.0
vendor: TXN2
formats:
- deb
- rpm
recommends:
- rpm

# Archive customization
archive:
# You can change the name of the archive.
# This is parsed with Golang template engine and the following variables.
name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"

# Archive format. Valid options are `tar.gz` and `zip`.
# Default is `zip`
format: tar.gz

# Replacements for GOOS and GOARCH on the archive name.
# The keys should be valid GOOS or GOARCH values followed by your custom
# replacements.
# By default, `replacements` replace GOOS and GOARCH values with valid outputs
# of `uname -s` and `uname -m` respectively.
replacements:
amd64: amd64
386: 386
darwin: macOS
linux: linux

format_overrides:
- goos: windows
format: zip

# Additional files you want to add to the archive.
# Defaults are any files matching `LICENCE*`, `LICENSE*`,
# `README*` and `CHANGELOG*` (case-insensitive)
files:
- LICENSE

brew:
name: txeh

github:
owner: txn2
name: homebrew-tap

commit_author:
name: Craig Johnston
email: [email protected]

folder: Formula

homepage: https://github.com/txn2/txeh

description: "Etc Hosts Management Utility."

skip_upload: false

test: |-
txeh version
snapcraft:
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
summary: Etc Hosts Management Utility.
description: |
Kubernetes bulk port forwarding utility.
grade: stable
confinement: classic
2 changes: 1 addition & 1 deletion util/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var rootCmd = &cobra.Command{
| |___ _____| |__
| __\ \/ / _ \ '_ \
| |_ > < __/ | | |
\__/_/\_\___|_| |_| v` + VERSION + `
\__/_/\_\___|_| |_| v` + Version + `
Add, remove and re-associate hostname entries in your /etc/hosts file.
Read more including useage as a Go library at https://github.com/txn2/txeh`,
Expand Down
4 changes: 2 additions & 2 deletions util/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

const VERSION = "0.0.0"
var Version = "0.0.0"

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

0 comments on commit bf4cec1

Please sign in to comment.