From 2f6fbbda9ca7ef58c9e35845707872b7670f5512 Mon Sep 17 00:00:00 2001 From: Engin Diri Date: Tue, 19 Oct 2021 11:58:39 +0200 Subject: [PATCH] feat: add goreleaser for gt cli Signed-off-by: Engin Diri --- .github/workflows/release.yaml | 26 ++++++++++++++++++++++++++ .goreleaser.yml | 34 ++++++++++++++++++++++++++++++++++ README.md | 6 ++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..b1591b53 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + 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.17 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..5941cd5f --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,34 @@ +project_name: gt + +snapshot: + name_template: '{{ .Tag }}-SNAPSHOT' + +before: + hooks: + - go mod tidy + +dist: bin + +builds: + - id: gt + env: + - CGO_ENABLED=0 + main: ./cmd/gt + ldflags: + - -s + - -w + - -extldflags '-static' + goos: + - linux + - windows + - darwin + ignore: + - goos: windows + goarch: arm64 + goarch: + - amd64 + - arm64 + +archives: + - format: binary + name_template: '{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}' diff --git a/README.md b/README.md index 5ffc76f2..f0a47ac3 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,16 @@ ### Install +If you have Go 1.16+, you can directly install by running: + ```bash go install github.com/schwarzit/go-template/cmd/gt@latest ``` +#### Install from the released binaries +Download the desired version for your operating system and processor architecture from the [go-template releases page](https://github.com/SchwarzIT/go-template/releases). +Make the file executable and place it in a directory available in your $PATH. + ### Initialize your repo from the template [![asciicast](https://asciinema.org/a/441624.svg)](https://asciinema.org/a/441624?autoplay=1&speed=2&size=medium)