From c15e1d713d18f36f788ce9b4a7253baf90e75fc7 Mon Sep 17 00:00:00 2001 From: Matt Fellows Date: Mon, 1 Feb 2021 12:18:38 +1100 Subject: [PATCH] chore: add github and goreleaser --- .github/workflows/release.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/test.yml | 20 ++++++++++++++++++++ .goreleaser.yml | 25 +++++++++++++++++++++++++ Makefile | 3 ++- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..ba72eb5f5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: goreleaser + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..3bf211130 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +on: [push, pull_request] +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.15.x, 1.14.x, 1.13.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: make + env: + PACT_BROKER_TOKEN: '${{ secrets.PACT_BROKER_TOKEN }}' \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..768b80d2c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,25 @@ +# This is an example .goreleaser.yml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod download +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - '^chore:' + - '^wip:' diff --git a/Makefile b/Makefile index 0ef38752c..876a7fc3b 100755 --- a/Makefile +++ b/Makefile @@ -89,7 +89,8 @@ snyk-install: endif snyk: - @if [ "$$TRAVIS_PULL_REQUEST" != "false" ]; then\ + # only run on CI, but don't do for PRs because tokens aren't available + @if [ "$$GITHUB_HEAD_REF" = "" -a "$$GITHUB_REF" != "" ]; then\ snyk test; \ fi