From f7bfd2c9608b134175fc4c8730ac8cd51bebeba5 Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Mon, 22 Jun 2020 08:34:41 +0200 Subject: [PATCH] generate releases on tags as part of CI --- .github/workflows/main.yml | 20 +++++++++++++++----- .goreleaser.yml | 8 ++++++++ Makefile | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11272ca..dda3a8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,8 @@ -name: build - +name: ci on: push - jobs: - build: + test: runs-on: ubuntu-latest - steps: - name: checkout uses: actions/checkout@v2 @@ -18,3 +15,16 @@ jobs: - name: acceptance-test run: make docker-acceptance + + 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 db29770..381c7f6 100644 --- a/Makefile +++ b/Makefile @@ -29,4 +29,4 @@ docker-acceptance: build-bats docker run -t bats acceptance.bats release: - goreleaser --rm-dist \ No newline at end of file + docker run -e GITHUB_TOKEN -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform goreleaser/goreleaser:v0.138 goreleaser release --rm-dist \ No newline at end of file