Skip to content

Commit

Permalink
Introduce GoReleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
jenslauterbach committed Oct 8, 2020
1 parent 39fe3d3 commit e612231
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
32 changes: 32 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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:'
8 changes: 5 additions & 3 deletions cmd/ddbt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
)
Expand All @@ -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
}

Expand Down

0 comments on commit e612231

Please sign in to comment.