From c01af77a99eef0c140b4f3a7a64ead10c97f9bf8 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Wed, 13 Apr 2022 15:26:32 +0700 Subject: [PATCH] chore: add github release --- .github/workflows/go.yaml | 23 ++++++++++++++++++----- .github/workflows/goreleaser.yaml | 27 +++++++++++++++++++++++++++ .goreleaser.yml | 20 ++++++++++++++++++++ 3 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/goreleaser.yaml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index a7aaef0..393dbc3 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -14,10 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-go@v2 with: - go-version: "~1.16" - - run: go test -race ./... + go-version: "~1.18" + - run: go test -race -coverprofile=coverage.out ./... build: name: Build runs-on: ${{ matrix.os }} @@ -28,13 +30,24 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "~1.16" + go-version: "~1.18" - run: go build - lint: - name: Lint + golangci-lint: + name: golangci-lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: golangci/golangci-lint-action@v2 with: version: latest + semgrep: + name: semgrep + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: returntocorp/semgrep-action@v1 + with: + config: >- + p/security-audit + p/secrets + p/golang diff --git a/.github/workflows/goreleaser.yaml b/.github/workflows/goreleaser.yaml new file mode 100644 index 0000000..d3714b5 --- /dev/null +++ b/.github/workflows/goreleaser.yaml @@ -0,0 +1,27 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-go@v2 + with: + go-version: "~1.18" + - 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..2e66236 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,20 @@ +before: + hooks: + - go mod tidy +builds: + - main: . + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 +universal_binaries: + - replace: true +archives: + - format_overrides: + - goos: windows + format: zip +changelog: + skip: true