Skip to content

Commit

Permalink
Add version string
Browse files Browse the repository at this point in the history
  • Loading branch information
dsh2dsh committed Apr 23, 2024
1 parent b3e87b4 commit bb8c5aa
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 5 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
@@ -0,0 +1,2 @@
/.env.local
/dist/
37 changes: 37 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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"

builds:
- env:
- "CGO_ENABLED=0"
goos:
- "freebsd"
- "linux"
goarch:
- "amd64"
- "arm64"

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

changelog:
sort: "asc"
filters:
exclude:
- "^docs:"
- "^test:"
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func init() {
rootCmd.AddCommand(&transferCmd)
}

func Execute() {
func Execute(version string) {
rootCmd.Version = version
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"github.com/dsh2dsh/check_wg/cmd"
)
import "github.com/dsh2dsh/check_wg/cmd"

var version string

func main() {
cmd.Execute()
cmd.Execute(version)
}

0 comments on commit bb8c5aa

Please sign in to comment.