Setup goreleaser

This commit is contained in:
Ed Zynda
2025-01-03 07:08:49 +03:00
parent 88a8c7bf15
commit c4ed189f48
4 changed files with 82 additions and 1 deletions

33
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3
.gitignore vendored
View File

@@ -7,4 +7,5 @@ mcphost
.idea
test/
build/
scripts/
scripts/
dist/

45
.goreleaser.yaml Normal file
View File

@@ -0,0 +1,45 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
binary: mcphost
ldflags:
- -s -w -X main.version={{.Version}}
archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^ci:"
- Merge pull request
- Merge branch

View File

@@ -2,6 +2,8 @@ package main
import "github.com/mark3labs/mcphost/cmd"
var version = "dev"
func main() {
cmd.Execute()
}