From f1ea9921c7b11367a05f28dd1b3e627d24a03b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20W=C3=B3jtowicz?= Date: Tue, 9 Nov 2021 19:21:37 +0100 Subject: [PATCH] Add releaser --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ .goreleaser.yml | 14 +++++++++++++ IDEAS.md | 1 - Makefile | 8 +------ README.md | 13 ------------ 5 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .goreleaser.yml delete mode 100644 IDEAS.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..aa60733 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: Test and release + +permissions: + contents: write + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup go + uses: actions/setup-go@v1 + with: + go-version: 1.17.1 + + - name: Run tests + run: | + go test -v ./... + release: + runs-on: ubuntu-latest + needs: test + if: ${{ startsWith(github.ref, 'refs/tags/') }} + 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.1 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + 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 0000000..9758f2e --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,14 @@ +builds: + - + ldflags: + - -s -w + goarch: + - amd64 + - arm64 + goarm: + - 7 + ignore: + - goos: linux + goarch: arm64 + + binary: selleo diff --git a/IDEAS.md b/IDEAS.md deleted file mode 100644 index f0c49fc..0000000 --- a/IDEAS.md +++ /dev/null @@ -1 +0,0 @@ -# IDEAS diff --git a/Makefile b/Makefile index ed9b6dd..e12ed92 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,2 @@ -run: - go run main.go - test: - go test ./... -coverprofile=coverage.out -timeout=2m -parallel=4 - -coverage: test - go tool cover -html=coverage.out + go test ./... -timeout=2m -parallel=4 diff --git a/README.md b/README.md index 21b05ed..6dd5d3e 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,2 @@ # cli -## Install - -``` -asdf plugin-add golang https://github.com/kennyp/asdf-golang.git -``` - -## Run - -``` -make run -make test -make coverage # it will run tests first -```