draft of gorelease

pull/58/head v2.1.0-rc1
Simon Let 6 years ago
parent db60ab0187
commit 36a30ad2e5
  1. 5
      .github/workflows/release.yaml
  2. 45
      .goreleaser.yml
  3. 24
      cmd/collect/main.go
  4. 8
      cmd/control/main.go
  5. 16
      cmd/daemon/main.go
  6. 12
      cmd/evaluate/main.go
  7. 8
      cmd/inspect/main.go
  8. 24
      cmd/postcollect/main.go
  9. 12
      cmd/sanitize/main.go
  10. 24
      cmd/session-init/main.go

@ -1,8 +1,9 @@
name: goreleaser name: goreleaser
on: on:
pull_request: create:
push: tags:
- v*
jobs: jobs:
goreleaser: goreleaser:

@ -0,0 +1,45 @@
# .goreleaser.yml
project_name: resh
# resh_template: '{{ ProjectName }}_{{ .Version }}'
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
# You can have multiple builds defined as a yaml list
-
# ID of the build.
# Defaults to the project name.
id: "daemon"
# Path to main.go file or main package.
# Default is `.`.
main: ./cmd/daemon/main.go
# Binary name.
# Can be a path (e.g. `bin/app`) to wrap the binary in a directory.
# Default is the name of the project directory.
binary: resh-daemon
# Hooks can be used to customize the final binary,
# for example, to run generators.
# Those fields allow templates.
# Default is both hooks empty.
# hooks:
# pre: rice embed-go
# post: ./script.sh
signs:
- artifacts: checksum
release:
draft: true
# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: auto
# disable: true

@ -17,11 +17,11 @@ import (
"strconv" "strconv"
) )
// Version from git set during build // version tag from git set during build
var Version string var version string
// Revision from git set during build // Commit hash from git set during build
var Revision string var commit string
func main() { func main() {
usr, _ := user.Current() usr, _ := user.Current()
@ -104,23 +104,23 @@ func main() {
flag.Parse() flag.Parse()
if *showVersion == true { if *showVersion == true {
fmt.Println(Version) fmt.Println(version)
os.Exit(0) os.Exit(0)
} }
if *showRevision == true { if *showRevision == true {
fmt.Println(Revision) fmt.Println(commit)
os.Exit(0) os.Exit(0)
} }
if *requireVersion != "" && *requireVersion != Version { if *requireVersion != "" && *requireVersion != version {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh version: " + Version + "(resh version: " + version +
"; resh version of this terminal session: " + *requireVersion + "; resh version of this terminal session: " + *requireVersion +
")") ")")
os.Exit(3) os.Exit(3)
} }
if *requireRevision != "" && *requireRevision != Revision { if *requireRevision != "" && *requireRevision != commit {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh revision: " + Revision + "(resh revision: " + commit +
"; resh revision of this terminal session: " + *requireRevision + "; resh revision of this terminal session: " + *requireRevision +
")") ")")
os.Exit(3) os.Exit(3)
@ -234,8 +234,8 @@ func main() {
PartOne: true, PartOne: true,
ReshUUID: collect.ReadFileContent(reshUUIDPath), ReshUUID: collect.ReadFileContent(reshUUIDPath),
ReshVersion: Version, ReshVersion: version,
ReshRevision: Revision, ReshRevision: commit,
RecallActionsRaw: *recallActions, RecallActionsRaw: *recallActions,
RecallPrefix: *recallPrefix, RecallPrefix: *recallPrefix,

@ -6,11 +6,11 @@ import (
"github.com/curusarn/resh/cmd/control/cmd" "github.com/curusarn/resh/cmd/control/cmd"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
os.Exit(int(cmd.Execute())) os.Exit(int(cmd.Execute()))

@ -17,16 +17,16 @@ import (
"github.com/curusarn/resh/pkg/cfg" "github.com/curusarn/resh/pkg/cfg"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
log.Println("Daemon starting... \n" + log.Println("Daemon starting... \n" +
"version: " + Version + "version: " + version +
" revision: " + Revision) " commit: " + commit)
usr, _ := user.Current() usr, _ := user.Current()
dir := usr.HomeDir dir := usr.HomeDir
pidfilePath := filepath.Join(dir, ".resh/resh.pid") pidfilePath := filepath.Join(dir, ".resh/resh.pid")
@ -85,8 +85,8 @@ func main() {
} }
func statusHandler(w http.ResponseWriter, r *http.Request) { func statusHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK; version: " + Version + w.Write([]byte("OK; version: " + version +
"; revision: " + Revision + "\n")) "; commit: " + commit + "\n"))
log.Println("Status OK") log.Println("Status OK")
} }

@ -13,11 +13,11 @@ import (
"github.com/curusarn/resh/pkg/strat" "github.com/curusarn/resh/pkg/strat"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
const maxCandidates = 50 const maxCandidates = 50
@ -50,11 +50,11 @@ func main() {
// handle show{Version,Revision} options // handle show{Version,Revision} options
if *showVersion == true { if *showVersion == true {
fmt.Println(Version) fmt.Println(version)
os.Exit(0) os.Exit(0)
} }
if *showRevision == true { if *showRevision == true {
fmt.Println(Revision) fmt.Println(commit)
os.Exit(0) os.Exit(0)
} }

@ -18,11 +18,11 @@ import (
"strconv" "strconv"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
usr, _ := user.Current() usr, _ := user.Current()

@ -17,11 +17,11 @@ import (
"strconv" "strconv"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
usr, _ := user.Current() usr, _ := user.Current()
@ -66,23 +66,23 @@ func main() {
flag.Parse() flag.Parse()
if *showVersion == true { if *showVersion == true {
fmt.Println(Version) fmt.Println(version)
os.Exit(0) os.Exit(0)
} }
if *showRevision == true { if *showRevision == true {
fmt.Println(Revision) fmt.Println(commit)
os.Exit(0) os.Exit(0)
} }
if *requireVersion != "" && *requireVersion != Version { if *requireVersion != "" && *requireVersion != version {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh version: " + Version + "(resh version: " + version +
"; resh version of this terminal session: " + *requireVersion + "; resh version of this terminal session: " + *requireVersion +
")") ")")
os.Exit(3) os.Exit(3)
} }
if *requireRevision != "" && *requireRevision != Revision { if *requireRevision != "" && *requireRevision != commit {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh revision: " + Revision + "(resh revision: " + commit +
"; resh revision of this terminal session: " + *requireRevision + "; resh revision of this terminal session: " + *requireRevision +
")") ")")
os.Exit(3) os.Exit(3)
@ -141,8 +141,8 @@ func main() {
PartOne: false, PartOne: false,
ReshUUID: collect.ReadFileContent(reshUUIDPath), ReshUUID: collect.ReadFileContent(reshUUIDPath),
ReshVersion: Version, ReshVersion: version,
ReshRevision: Revision, ReshRevision: commit,
}, },
} }
collect.SendRecord(rec, strconv.Itoa(config.Port), "/record") collect.SendRecord(rec, strconv.Itoa(config.Port), "/record")

@ -23,11 +23,11 @@ import (
giturls "github.com/whilp/git-urls" giturls "github.com/whilp/git-urls"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
usr, _ := user.Current() usr, _ := user.Current()
@ -45,11 +45,11 @@ func main() {
flag.Parse() flag.Parse()
if *showVersion == true { if *showVersion == true {
fmt.Println(Version) fmt.Println(version)
os.Exit(0) os.Exit(0)
} }
if *showRevision == true { if *showRevision == true {
fmt.Println(Revision) fmt.Println(commit)
os.Exit(0) os.Exit(0)
} }
sanitizer := sanitizer{hashLength: *trimHashes} sanitizer := sanitizer{hashLength: *trimHashes}

@ -16,11 +16,11 @@ import (
"strconv" "strconv"
) )
// Version from git set during build // version from git set during build
var Version string var version string
// Revision from git set during build // commit from git set during build
var Revision string var commit string
func main() { func main() {
usr, _ := user.Current() usr, _ := user.Current()
@ -83,23 +83,23 @@ func main() {
flag.Parse() flag.Parse()
if *showVersion == true { if *showVersion == true {
fmt.Println(Version) fmt.Println(version)
os.Exit(0) os.Exit(0)
} }
if *showRevision == true { if *showRevision == true {
fmt.Println(Revision) fmt.Println(commit)
os.Exit(0) os.Exit(0)
} }
if *requireVersion != "" && *requireVersion != Version { if *requireVersion != "" && *requireVersion != version {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh version: " + Version + "(resh version: " + version +
"; resh version of this terminal session: " + *requireVersion + "; resh version of this terminal session: " + *requireVersion +
")") ")")
os.Exit(3) os.Exit(3)
} }
if *requireRevision != "" && *requireRevision != Revision { if *requireRevision != "" && *requireRevision != commit {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh revision: " + Revision + "(resh revision: " + commit +
"; resh revision of this terminal session: " + *requireRevision + "; resh revision of this terminal session: " + *requireRevision +
")") ")")
os.Exit(3) os.Exit(3)
@ -178,8 +178,8 @@ func main() {
OsReleasePrettyName: *osReleasePrettyName, OsReleasePrettyName: *osReleasePrettyName,
ReshUUID: collect.ReadFileContent(reshUUIDPath), ReshUUID: collect.ReadFileContent(reshUUIDPath),
ReshVersion: Version, ReshVersion: version,
ReshRevision: Revision, ReshRevision: commit,
}, },
} }
collect.SendRecord(rec, strconv.Itoa(config.Port), "/session_init") collect.SendRecord(rec, strconv.Itoa(config.Port), "/session_init")

Loading…
Cancel
Save