Skip to content

Commit

Permalink
Add version and doc link to help (#15)
Browse files Browse the repository at this point in the history
* Add version and doc link to help

* adjust action

* remove print from action

* Remove binary
  • Loading branch information
ludeeus authored Sep 27, 2021
1 parent 0245ed0 commit 183b708
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ jobs:
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Get version
id: version
uses: home-assistant/actions/helpers/version@master

- name: Build ${{ matrix.variant.name }}
run: CGO_ENABLED=0 ${{ matrix.variant.args }} go build -ldflags="-s -w" -o "${{ matrix.variant.name }}"
run: |
CGO_ENABLED=0 ${{ matrix.variant.args }} go build -ldflags="-s -w -X main.TempioVersion=${{ steps.version.outputs.version }}" -o "${{ matrix.variant.name }}"
- name: Upload release asset
if: github.event_name == 'release'
Expand Down
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ import (
"log"
)

var TempioVersion string

func main() {
var config *map[string]interface{}
configFile := flag.String("conf", "", "Config json file, can be omitted if used in a pipe")
templateFile := flag.String("template", "", "Template file")
outFile := flag.String("out", "", "Output file, if not defined output will be to console")

flag.Usage = func() {
writer := flag.CommandLine.Output()

fmt.Fprintf(writer, "Version: %s\n", TempioVersion)
fmt.Fprintf(writer, "Documentation: https://github.com/home-assistant/tempio\n\n")

flag.PrintDefaults()
}

// parse command lines
flag.Parse()
if *templateFile == "" {
Expand Down

0 comments on commit 183b708

Please sign in to comment.