From 66f3818d14154bbbaea37048b7b94ef10c326bda Mon Sep 17 00:00:00 2001 From: Denis Krivak Date: Sun, 3 May 2020 17:32:35 +0300 Subject: [PATCH] Add goreleaser. --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ .github/workflows/test.yml | 3 --- .gitignore | 1 + .goreleaser.yml | 12 ++++++++++++ Makefile | 8 +++++--- README.md | 13 +++++++++++++ 6 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..656a7d4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +on: + push: + tags: ['*'] + +name: Release + +jobs: + goreleaser: + runs-on: ubuntu-latest + + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + - name: Checkout code + uses: actions/checkout@v2 + - name: Unshallow + run: git fetch --prune --unshallow + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1cbcd1..ffecae8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,13 +4,10 @@ name: Test jobs: test: - name: Test - strategy: matrix: go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x] platform: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.platform }} steps: - name: Install Go diff --git a/.gitignore b/.gitignore index 339f170..2b87e39 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +/dist/ /godot diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..87a05a2 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,12 @@ +builds: + - dir: ./cmd/godot +checksum: + name_template: checksums.txt +snapshot: + name_template: "{{ .Tag }}" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/Makefile b/Makefile index 6fc7b5f..fee7693 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,11 @@ -VERSION := $(shell git describe --tags) - .PHONY: test test: go test ./... .PHONY: build build: - go build -ldflags="-X 'main.version=$(VERSION)'" -o godot ./cmd/godot + go build -o godot ./cmd/godot + +.PHONY: release +release: + goreleaser release --rm-dist diff --git a/README.md b/README.md index 569d4e5..dabdec3 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,21 @@ end of the last sentence if needed. ## Install and run +Build from source ```sh go get -u github.com/tetafro/godot/cmd/godot +``` + +Or download binary from [releases page](https://github.com/tetafro/godot/releases) +like this +```sh +version=0.3.5 +platform=linux_amd64 +curl -L https://github.com/tetafro/godot/releases/download/v${version}/godot_${version}_${platform}.tar.gz | tar xzf - -C $GOPATH/bin +``` + +Run +```sh godot ./myproject ```