Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #37 from chifu1234/dev
Browse files Browse the repository at this point in the history
feautre: #36 adding github actions go release
  • Loading branch information
oliverbaehler authored Apr 25, 2021
2 parents 6ad3507 + ae303e3 commit 34dc279
Show file tree
Hide file tree
Showing 98 changed files with 256 additions and 133 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
tags:
- '*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.15.x, 1.16.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: go test ./
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
main
kusible
coverage/
release/
release/dist/
37 changes: 37 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com

env:
- GO111MODULE=on
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
- -s -w -X github.com/bedag/kusible/cmd.version={{.Version}} -X github.com/bedag/kusible/cmd.commit={{.Commit}} -X github.com/bedag/kusible/cmd.date={{.Date}}
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
2 changes: 1 addition & 1 deletion cmd/cli.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2020 Michael Gruener & Simon Fuhrer
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy_helm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/flags.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Michael Gruener & Simon Fuhrer
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/groups.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/inventory.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/inventory_kubeconfig.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/inventory_list.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/inventory_loader.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/inventory_values.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/render.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/render_argocd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/render_helm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/render_playbook.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/uninstall.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/uninstall_helm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/util.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmd/values.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
52 changes: 16 additions & 36 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2019 Michael Gruener
Copyright © 2021 Bedag Inforamtik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -19,51 +19,31 @@ package cmd
import (
"fmt"

"encoding/json"
goVersion "go.hein.dev/go-version"

"github.com/spf13/cobra"
)

const appName = "kusible"

// Version is the application version. It will be overriden during the build process.
// See https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
var Version = "development"

// BuildTime is the date/time when the binary was build. It should be set by the build process and will not be
// displayed if it is empty.
var BuildTime string

// GitRev is the Git revision of the code the binary is build from. It should be set by the build process and will not be
// displayed if it is empty.
var GitRev string

// GitTreeState indicates if the git tree had uncommited changes when the binary was build. It should be set by the build
// process and will not be displayed if it is empty.
var GitTreeState string

type BuildInfo struct {
Version string `json:"Version,omitempty"`
GitRev string `json:"GitRev,omitempty"`
BuildTime string `json:"BuildTime,omitempty"`
GitTreeState string `json:"GitTreeState,omitempty"`
}

var (
shortened = false
version = "dev"
commit = "none"
date = "unknown"
output = "json"
)
func newVersionCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: fmt.Sprint("Print the version number of ", appName),
Run: func(cmd *cobra.Command, args []string) {
bi := BuildInfo{
Version: Version,
GitRev: GitRev,
BuildTime: BuildTime,
GitTreeState: GitTreeState,
}

version, _ := json.MarshalIndent(bi, "", " ")
fmt.Println(string(version))
Short: "Version will output the current build information",
Long: ``,
Run: func(_ *cobra.Command, _ []string) {
resp := goVersion.FuncWithOutput(shortened, version, commit, date, output)
fmt.Print(resp)
return
},
}
return cmd
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
go.hein.dev/go-version v0.1.0
gotest.tools v2.2.0+incompatible
helm.sh/helm/v3 v3.5.3
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/apiserver v0.20.2
k8s.io/cli-runtime v0.20.2
k8s.io/client-go v0.20.2
sigs.k8s.io/yaml v1.2.0
Expand Down
Loading

0 comments on commit 34dc279

Please sign in to comment.