From 05508ddb9642a7637a274d0eaeb127df0f140795 Mon Sep 17 00:00:00 2001 From: Louis Garman Date: Tue, 19 Mar 2024 15:21:35 +0000 Subject: [PATCH] wip --- .github/workflows/build.yml | 58 +++++++++++++++++++++++++++++++++++++ Makefile | 6 ++-- 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..583f5aad --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,58 @@ +name: build + +on: + push: + branches: + - master + tags: + - 'v*.*.*' + pull_request: + branches: + - '*' + +jobs: + build: + # You must use a Linux environment when using service containers or container jobs + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + - name: Lint check + run: make install-linter lint + - name: Vet check + run: make vet + - name: Tests + run: make test + release-please: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + outputs: + release_created: ${{ steps.release-please.outputs.release_created }} + tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0 + version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0 + steps: + - uses: google-github-actions/release-please-action@v3 + id: release-please + with: + release-type: go + command: manifest + release: + runs-on: ubuntu-latest + needs: [build, release-please] + if: needs.release-please.outputs.release_created + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + - uses: goreleaser/goreleaser-action@v5 + with: + args: release --clean --skip-sign --skip-validate + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index dbd8b89b..566d0135 100644 --- a/Makefile +++ b/Makefile @@ -26,12 +26,14 @@ test: lint: go list ./... | xargs staticcheck -# Run go fmt against code .PHONY: fmt fmt: go fmt ./... -# Run go vet against code .PHONY: vet vet: go vet ./... + +.PHONY: install-linter +install-linter: + go install honnef.co/go/tools/cmd/staticcheck@latest