diff --git a/.gitignore b/.gitignore index 638470f..21e3e91 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ *.csv /htmltable2csv +/dist diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..0657938 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,9 @@ +project_name: htmltable2csv +builds: + - binary: htmltable2csv + goos: + - darwin + - linux + goarch: + - amd64 + - 386 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9a5b9f5 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +VERSION=0.1.0 + +all: lint test + +build: + @go build + +lint: + @go fmt ./... + @golint ./... + +test: build + @./htmltable2csv -v + @./htmltable2csv -url "https://www.w3schools.com/html/html_tables.asp" -selector "#customers > tbody > tr" -csv data.csv + +release: + git tag -a v${VERSION} -m "Version ${VERSION}" + git push origin v${VERSION} + goreleaser + +.PHONY: all lint build test release diff --git a/main.go b/main.go index db82cf9..f488732 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,11 @@ import ( "github.com/paulvollmer/htmltable2csv/scraper" ) -const version = "0.1.0" +var ( + version = "dev" + commit = "none" + date = "unknown" +) func usage() { fmt.Println("Usage: htmltable2csv [flags]") @@ -28,7 +32,7 @@ func main() { flag.Parse() if *flagVersion { - fmt.Printf("v%s\n", version) + fmt.Printf("%v, commit %v, built at %v", version, commit, date) os.Exit(0) }