diff --git a/.goreleaser.yml b/.goreleaser.yml index 51edcef..4873f2b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,9 +1,26 @@ -build: +project_name: "mvs" + +before: + hooks: + - go mod vendor + +builds: +- binary: "mvs" main: main.go - binary: mvs - ldflags: -s -w -X github.com/hofstadter-io/mvs/commands.Version={{.Version}} -X github.com/hofstadter-io/mvs/commands.Commit={{.ShortCommit}} -X github.com/hofstadter-io/mvs/commands.BuildDate={{.Date}} + + ldflags: + - -s -w + - -X github.com/hofstadter-io/mvs/commands.Version={{.Version}} + - -X github.com/hofstadter-io/mvs/commands.Commit={{.FullCommit}} + - -X github.com/hofstadter-io/mvs/commands.BuildDate={{.Date}} + - -X github.com/hofstadter-io/mvs/commands.GoVersion=go1.14 + - -X github.com/hofstadter-io/mvs/commands.BuildOS={{.Os}} + - -X github.com/hofstadter-io/mvs/commands.BuildArch={{.Arch}} + - -X github.com/hofstadter-io/mvs/commands.BuildArm={{.Arm}} + env: - - CGO_ENABLED=0 + - CGO_ENABLED=0 + goos: - darwin - linux @@ -11,35 +28,70 @@ build: goarch: - amd64 - arm64 + - arm -archive: - format: tar.gz - format_overrides: - - goos: windows - format: zip - name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}" + ignore: + - goos: linux + goarch: arm + + +snapshot: + name_template: "{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}" + +archives: +- format: binary replacements: - amd64: 64bit - arm: ARM - arm64: ARM64 - darwin: MacOS + darwin: Darwin linux: Linux windows: Windows + amd64: x86_64 + # Needed hack for binary only uploads + # For more information, check #602 files: - - README.md - - LICENSE + - "thisfiledoesnotexist*" + + +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' -brew: - name: mvs - github: - owner: hofstadter-io - name: homebrew-tap - folder: Formula - commit_author: - name: verdverm - email: tony@hofstadter.io - homepage: https://github.com/hofstadter-io/mvs - description: 'MVS is a polyglot dependency management tool based on go mods' release: + disable: true draft: true + github: + owner: hofstadter-io + name: hof + +dockers: +- binaries: + - mvs + skip_push: true + dockerfile: ci/docker/Dockerfile.jessie + image_templates: + - "hofstadter/{{.ProjectName}}:{{.Tag}}" + - "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}" + - "hofstadter/{{.ProjectName}}:v{{ .Major }}" + - "hofstadter/{{.ProjectName}}:latest" + + - "hofstadter/{{.ProjectName}}:{{.Tag}}-debian" + - "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-debian" + - "hofstadter/{{.ProjectName}}:v{{ .Major }}-debian" + - "hofstadter/{{.ProjectName}}:latest-debian" + + +- binaries: + - mvs + skip_push: true + dockerfile: ci/docker/Dockerfile.scratch + image_templates: + - "hofstadter/{{.ProjectName}}:{{.Tag}}-scratch" + - "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-scratch" + - "hofstadter/{{.ProjectName}}:v{{ .Major }}-scratch" + - "hofstadter/{{.ProjectName}}:latest-scratch" diff --git a/ci/docker/Dockerfile.jessie b/ci/docker/Dockerfile.jessie new file mode 100644 index 0000000..55767d5 --- /dev/null +++ b/ci/docker/Dockerfile.jessie @@ -0,0 +1,8 @@ +FROM debian:jessie +MAINTAINER Hofstadter, Inc + +COPY mvs /usr/bin/local +ENTRYPOINT ["mvs"] + +VOLUME ["/work"] +WORKDIR /work diff --git a/ci/docker/Dockerfile.scratch b/ci/docker/Dockerfile.scratch new file mode 100644 index 0000000..1664b60 --- /dev/null +++ b/ci/docker/Dockerfile.scratch @@ -0,0 +1,8 @@ +FROM scratch +MAINTAINER Hofstadter, Inc + +COPY mvs / +ENTRYPOINT ["/mvs"] + +VOLUME ["/work"] +WORKDIR /work diff --git a/cli.cue b/cli.cue index 68904ec..380b663 100644 --- a/cli.cue +++ b/cli.cue @@ -42,15 +42,18 @@ CLI :: schema.Cli & { """ Releases: schema.GoReleaser & { - Author: "Tony Worm" - Homepage: "https://github.com/hofstadter-io/mvs" - - Brew: { - GitHubOwner: "hofstadter-io" - GitHubRepoName: "homebrew-tap" - GitHubUsername: "verdverm" - GitHubEmail: "tony@hofstadter.io" - } + Author: "Tony Worm" + Homepage: "https://github.com/hofstadter-io/mvs" + + GitHub: { + Owner: "hofstadter-io" + Repo: "hof" + } + + Docker: { + Maintainer: "Hofstadter, Inc " + Repo: "hofstadter" + } } OmitRun: true diff --git a/commands/convert.go b/commands/convert.go index ef959ea..8ada787 100644 --- a/commands/convert.go +++ b/commands/convert.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "os" "github.com/spf13/cobra" diff --git a/commands/graph.go b/commands/graph.go index 25cd6ef..d8fcf43 100644 --- a/commands/graph.go +++ b/commands/graph.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/hack.go b/commands/hack.go index febd4d7..49dc242 100644 --- a/commands/hack.go +++ b/commands/hack.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/info.go b/commands/info.go index 7f98b7f..a6ca000 100644 --- a/commands/info.go +++ b/commands/info.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/init.go b/commands/init.go index ad50248..f292615 100644 --- a/commands/init.go +++ b/commands/init.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "os" "github.com/spf13/cobra" diff --git a/commands/status.go b/commands/status.go index 9b33227..b9e4c42 100644 --- a/commands/status.go +++ b/commands/status.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/tidy.go b/commands/tidy.go index 367048b..b80524f 100644 --- a/commands/tidy.go +++ b/commands/tidy.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/vendor.go b/commands/vendor.go index 8147ddf..b2b904e 100644 --- a/commands/vendor.go +++ b/commands/vendor.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/verify.go b/commands/verify.go index 6095c12..2e87cfd 100644 --- a/commands/verify.go +++ b/commands/verify.go @@ -1,6 +1,9 @@ package commands import ( + + // hello... something might need to go here + "github.com/spf13/cobra" "fmt" diff --git a/commands/version.go b/commands/version.go index feeb3fa..fa8dfee 100644 --- a/commands/version.go +++ b/commands/version.go @@ -2,19 +2,29 @@ package commands import ( "fmt" - "os" - "time" "github.com/spf13/cobra" ) var ( - Version = "dev" - Commit = "dirty" - BuiltBy = os.Getenv("USER") - BuildDate = time.Now().String() + Version = "Local" + Commit = "Dirty" + + BuildDate = "Unknown" + GoVersion = "Unknown" + BuildOS = "Unknown" + BuildArch = "Unknown" ) +const versionMessage = ` +Version: v%s +Commit: %s + +BuildDate: %s +GoVersion: %s +OS / Arch: %s %s +` + var VersionLong = `Print the build version for mvs` var VersionCmd = &cobra.Command{ @@ -30,7 +40,15 @@ var VersionCmd = &cobra.Command{ Long: VersionLong, Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Version: %v\nCommit: %v\nBuiltBy: %v\nBuildDate: %v\n", Version, Commit, BuiltBy, BuildDate) + fmt.Printf( + versionMessage, + Version, + Commit, + BuildDate, + GoVersion, + BuildOS, + BuildArch, + ) }, } diff --git a/cue.mods b/cue.mods index 97c2ec6..b6c0bae 100644 --- a/cue.mods +++ b/cue.mods @@ -4,5 +4,5 @@ cue 0.1.1 require ( github.com/hofstadter-io/cuelib v0.0.5 - github.com/hofstadter-io/hofmod-cli v0.3.0 + github.com/hofstadter-io/hofmod-cli v0.3.4 ) diff --git a/cue.sums b/cue.sums index 8fc799c..d343ec2 100644 --- a/cue.sums +++ b/cue.sums @@ -4,5 +4,11 @@ github.com/hofstadter-io/cuetest v0.0.2 h1:UAzHAbZYF1dPck2qQAJ4FwhVC1op7F7s+4UC0 github.com/hofstadter-io/cuetest v0.0.2/cue.mods h1:KE5GytNGpbuRzzNWR5Lq7KAy04uu3fQ3hCClpF7+olE= github.com/hofstadter-io/hof v0.2.5 h1:yvK+OFV6lOaTm9lEuo8PWXB9B0XoAqzF1Pdgoyd3VSE= github.com/hofstadter-io/hof v0.2.5/cue.mods h1:swmc9Mr85o+M/oWXTPH+SebEQp3ptVAT0AoKlrLNEVo= +github.com/hofstadter-io/hof v0.2.9 h1:gL18XFCUmWzg+COh51fNlS0PD+X1pyr0cq0HSP1tE/8= +github.com/hofstadter-io/hof v0.2.9/cue.mods h1:dKBlrnHECy4JCN+Dsy7W0djaHgh241bRCUgClo2i6LU= github.com/hofstadter-io/hofmod-cli v0.3.0 h1:+wCqHV08voZyt87uKKFpNOst6wON+OFOEqTViIF4Enk= github.com/hofstadter-io/hofmod-cli v0.3.0/cue.mods h1:hvuTtdDNMFf5D9Jv0SfQfg2qRBOkFGb+EVOwkVtYKQI= +github.com/hofstadter-io/hofmod-cli v0.3.3 h1:JSuT+8Bm8b7CqSMZqtXuzSWt8bFCuGIsbd5UEmOKCSg= +github.com/hofstadter-io/hofmod-cli v0.3.3/cue.mods h1:YmxImIIBaXUl/P54xJqbLzLTFvpYCNQBhoyVCCfmad0= +github.com/hofstadter-io/hofmod-cli v0.3.4 h1:cpq6IIm9B3X8v8bIhxOLBRnhRSEcsrgK/nLbt29ChKY= +github.com/hofstadter-io/hofmod-cli v0.3.4/cue.mods h1:YmxImIIBaXUl/P54xJqbLzLTFvpYCNQBhoyVCCfmad0= diff --git a/lib/modder/modder_write.go b/lib/modder/modder_write.go index 748c61b..5c7a8fb 100644 --- a/lib/modder/modder_write.go +++ b/lib/modder/modder_write.go @@ -66,11 +66,7 @@ func (mdr *Modder) WriteVendor() error { mdr.module.SumFile.Add(mver, modhash) baseDir := path.Join(mdr.ModsDir, m.Module) - // TODO make billy FS here - if m.ReplaceVersion == "" { - m.ReplaceVersion = "latest" - } fmt.Printf("Writing %-48s => %s\n", m.ReplaceModule + "@" + m.ReplaceVersion, baseDir) // copy definite files always