diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..94602de --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Create Release + +on: + workflow_dispatch: + push: + tags: + - '*' + +jobs: + + goreleaser: + name: Build and Distribute Release + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..cacd6c1 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,32 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod download +builds: + - + main: cmd/ddbt/main.go + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/cmd/ddbt/main.go b/cmd/ddbt/main.go index 231539d..cad2fa0 100644 --- a/cmd/ddbt/main.go +++ b/cmd/ddbt/main.go @@ -52,8 +52,10 @@ Options: ) var ( - // commandVersion is the version of the ddbt tool, which is set at build time using ldflags - commandVersion = "development" + // The following variables are set by goreleaser: + version = "dev" + date = "unknown" + errTableMissing = errors.New("no table name provided") errReadPipe = errors.New("unable to read table name from pipe (stdin)") ) @@ -78,7 +80,7 @@ func run(args []string) error { } if parsedArguments.version { - fmt.Fprintf(os.Stdout, "ddbt %s\n", commandVersion) + fmt.Fprintf(os.Stdout, "ddbt %s\n (built at %s)", version, date) return nil }