Skip to content

Commit

Permalink
Configure goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
dsh2dsh committed Apr 23, 2024
1 parent 9288de2 commit 8d9fdf0
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://goreleaser.com/ci/actions/#workflow
name: "goreleaser"

on:
workflow_dispatch:
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@v5"
with:
go-version-file: 'go.mod'

- name: "Run GoReleaser"
uses: "goreleaser/goreleaser-action@v5"
with:
version: "latest"
args: "release --clean"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ _testmain.go
*.exe
*.test
*.prof

/release-dist/
41 changes: 41 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
- "go mod tidy"

dist: "./release-dist"

builds:
- env:
- "CGO_ENABLED=0"
goos:
- "freebsd"
- "linux"
goarch:
- "amd64"
- "arm64"
ldflags:
- "-s -w -X github.com/{{.ProjectName}}/{{.ProjectName}}/version.{{.ProjectName}}Version={{.Version}}"

archives:
- format: "tar.gz"
# use zip for windows archives
format_overrides:
- goos: "windows"
format: "zip"

changelog:
sort: "asc"
filters:
exclude:
- "^docs:"
- "^test:"
5 changes: 3 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/zrepl/zrepl/daemon/logging/trace"

"github.com/zrepl/zrepl/config"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/version"
)

var rootArgs struct {
Expand Down Expand Up @@ -153,6 +153,7 @@ func addSubcommandToCobraCmd(c *cobra.Command, s *Subcommand) {
}

func Run() {
rootCmd.Version = version.NewZreplVersionInformation().Version
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
Expand Down

0 comments on commit 8d9fdf0

Please sign in to comment.