Skip to content

Commit

Permalink
feat(ci): add go releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed May 29, 2024
1 parent 9dd16a5 commit 7b34bdd
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,33 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
release:
release-please:
name: Release
runs-on: ubuntu-latest
needs: [test, lint]
if: github.ref == 'refs/heads/main'
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
steps:
- uses: google-github-actions/release-please-action@v4
- uses: googleapis/release-please-action@v4
id: release-please
with:
token: ${{ secrets.REPO_TOKEN }}
release-type: go

goreleaser:
name: Publish
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
32 changes: 32 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 1
before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
skip: true

checksum:
name_template: "checksums.txt"

0 comments on commit 7b34bdd

Please sign in to comment.