From 7c65b1d4df3a9682d9f73439b8e64c4564a88ac8 Mon Sep 17 00:00:00 2001 From: VKambulov Date: Sun, 1 Sep 2024 15:24:42 +0300 Subject: [PATCH] Setting up GoReleaser and GitHub Actions for releases. --- .github/workflows/goreleaser.yml | 26 ++++++++++++++++++++++++ .gitignore | 1 + .goreleaser.yaml | 34 ++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..fb7fa93 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,26 @@ +name: goreleaser + +on: + release: + types: [ released ] + +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@v5 + with: + go-version: 1.23 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 9ba2489..1bb8c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea +dist/ *.iml .env app.log diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..da1ac86 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,34 @@ +version: 2 + +before: + hooks: + - go mod tidy + - go generate ./... + +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: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:"