diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10ac908..2df06bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ -name: build +name: ci on: push jobs: - build: + test: runs-on: ubuntu-latest steps: - name: checkout @@ -10,5 +10,15 @@ jobs: - name: test run: make docker-test - - name: build - run: make docker-build-static + goreleaser: + runs-on: ubuntu-latest + needs: test + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: goreleaser + run: make release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 63161a7..60c78fe 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,10 +1,18 @@ builds: - env: - CGO_ENABLED=0 + - GOFLAGS = -mod=vendor + - GO111MODULE = on goos: - windows - linux - darwin + flags: + - -trimpath + - -tags=netgo + - -a + ldflags: + - -extldflags "-static" archives: - format: tar.gz format_overrides: diff --git a/Makefile b/Makefile index 8e7dc9e..fe95cef 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,7 @@ docker-test: docker run -t -v $$PWD:/go/src/github.com/yannh/redis-dump-go -w /go/src/github.com/yannh/redis-dump-go golang:1.14 make test docker-build-static: - docker run -t -v $$PWD:/go/src/github.com/yannh/redis-dump-go -w /go/src/github.com/yannh/redis-dump-go golang:1.14 make build-static \ No newline at end of file + docker run -t -v $$PWD:/go/src/github.com/yannh/redis-dump-go -w /go/src/github.com/yannh/redis-dump-go golang:1.14 make build-static + +release: + docker run -e GITHUB_TOKEN -t -v $$PWD:/go/src/github.com/yannh/redis-dump-go -w /go/src/github.com/yannh/redis-dump-go goreleaser/goreleaser:v0.138 goreleaser release --rm-dist \ No newline at end of file diff --git a/Readme.md b/Readme.md index 571eb82..28d6725 100644 --- a/Readme.md +++ b/Readme.md @@ -4,10 +4,10 @@ Dump Redis keys to a file. Similar in spirit to https://www.npmjs.com/package/redis-dump and https://github.com/delano/redis-dump but: -* Will dump keys across several processes & connections -* Uses SCAN rather than KEYS * for much reduced memory footprint with large databases -* Easy to deploy & containerize - single binary. -* Generates a [RESP](https://redis.io/topics/protocol) file rather than a JSON or a list of commands. This is faster to ingest, and [recommended by Redis](https://redis.io/topics/mass-insert) for mass-inserts. +* Will dump keys across **several processes & connections** +* Uses SCAN rather than KEYS * for much **reduced memory footprint** with large databases +* Easy to deploy & containerize - **single binary**. +* Generates a [RESP](https://redis.io/topics/protocol) file rather than a JSON or a list of commands. This is **faster to ingest**, and [recommended by Redis](https://redis.io/topics/mass-insert) for mass-inserts. Warning: like similar tools, Redis-dump-go does NOT provide Point-in-Time backups. Please use [Redis backups methods](https://redis.io/topics/persistence) when possible.