From 74b867f07553063d8e367844135ce66327aac394 Mon Sep 17 00:00:00 2001 From: Traci Kamp Date: Sun, 1 Oct 2023 08:55:18 -0700 Subject: [PATCH] chore: configure goreleaser Configures goreleaser to build the binary --- .github/workflows/goreleaser.yaml | 19 +++++++++++++++++++ .github/workflows/release.yaml | 23 +++++++++++++++++++++++ .github/{ => workflows}/test.yaml | 11 ++++++----- .goreleaser.yml | 19 +++++++++++++++++++ 4 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/goreleaser.yaml create mode 100644 .github/workflows/release.yaml rename .github/{ => workflows}/test.yaml (89%) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/goreleaser.yaml b/.github/workflows/goreleaser.yaml new file mode 100644 index 0000000..8f066ee --- /dev/null +++ b/.github/workflows/goreleaser.yaml @@ -0,0 +1,19 @@ +name: GoReleaser +on: + push: + tags: + - '**' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + - uses: goreleaser/goreleaser-action@v2 + with: + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..0a2f224 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,23 @@ +name: Release +on: + workflow_run: + workflows: + - Test + branches: + - main + types: + - completed + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v3 + - env: + GITHUB_TOKEN: ${{ secrets.PAT }} + run: | + npx -p @semantic-release/changelog -p @semantic-release/git -p semantic-release semantic-release diff --git a/.github/test.yaml b/.github/workflows/test.yaml similarity index 89% rename from .github/test.yaml rename to .github/workflows/test.yaml index d328697..bb43fa6 100644 --- a/.github/test.yaml +++ b/.github/workflows/test.yaml @@ -11,13 +11,14 @@ jobs: test: runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: 1.20 - - name: Checkout code - uses: actions/checkout@v4 - - name: Test - run: go test -v ./... + - run: go version + - run: go mod download + - run: go test -v ./... golangci-lint: runs-on: ubuntu-latest @@ -54,4 +55,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | npx -p @semantic-release/changelog -p @semantic-release/git -p semantic-release \ - semantic-release -d --branches ${GITHUB_REF##*/} \ No newline at end of file + semantic-release -d --branches ${GITHUB_REF##*/} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..3b0487c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,19 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + binary: litterrobot +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - '^style:'