From 1c40d04824131f9bee3b6fd34f56e4b9b8b67c27 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Sun, 26 Nov 2023 22:27:55 +0100 Subject: [PATCH] refactor: include commit in release binary --- .goreleaser.yaml | 18 +----------------- Makefile | 6 +++--- README.md | 18 +++++++++--------- cmd/cmd.go | 2 ++ 4 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 1d03369..0ce47ec 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -11,7 +11,7 @@ builds: env: - CGO_ENABLED=0 ldflags: - - -s -w -X github.com/joseluisq/enve/cmd.versionNumber={{.Version}} -X github.com/joseluisq/enve/cmd.buildTime={{.Date}} + - -s -w -X github.com/joseluisq/enve/cmd.versionNumber={{.Version}} -X github.com/joseluisq/enve/cmd.buildCommit={{.Commit}} -X github.com/joseluisq/enve/cmd.buildTime={{.Date}} goos: - linux - darwin @@ -42,11 +42,6 @@ archives: - id: enve name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' format: tar.gz - replacements: - darwin: darwin - linux: linux - 386: i386 - amd64: amd64 files: - LICENSE-APACHE - LICENSE-MIT @@ -56,17 +51,6 @@ release: changelog: skip: true -signs: - - - cmd: gpg - args: - - --output - - $signature - - --detach-sig - - $artifact - signature: ${artifact}.sig - artifacts: none - snapshot: name_template: "{{ .Version }}" diff --git a/Makefile b/Makefile index 1ef0a91..b5f5b20 100644 --- a/Makefile +++ b/Makefile @@ -76,8 +76,8 @@ prod.release: set -u @go version - @git tag $(GIT_TAG) - @goreleaser release --rm-dist + @git tag $(GIT_TAG) --sign -m "$(GIT_TAG)" + @goreleaser release --clean --skip=publish --skip=validate .ONESHELL: prod.release prod.release.ci: @@ -85,6 +85,6 @@ prod.release.ci: set -u @go version - @git tag $(DRONE_TAG) + @git tag $(GIT_TAG) --sign -m "$(GIT_TAG)" @curl -sL https://git.io/goreleaser | bash .ONESHELL: prod.release.ci diff --git a/README.md b/README.md index 39ec66d..1da85d3 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ > Run a program in a modified environment providing a `.env` file. -**Enve** is a cross-platform tool which can load environment variables from a [`.env` file](https://www.ibm.com/docs/en/aix/7.2?topic=files-env-file) and execute a given command. -It also has the ability to output environment variables in `text`, `json` or `xml` format. +**Enve** is a cross-platform tool that can load environment variables from a [`.env` file](https://www.ibm.com/docs/en/aix/7.2?topic=files-env-file) and execute a given command. +It also can output environment variables in `text`, `json` or `xml` format. It can be considered as a counterpart of [GNU env](https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html) command. @@ -14,8 +14,8 @@ It can be considered as a counterpart of [GNU env](https://www.gnu.org/software/ ```sh curl -sSL \ - "https://github.com/joseluisq/enve/releases/download/v1.4.1/enve_v1.4.1_linux_amd64.tar.gz" \ -| sudo tar zxf - -C /usr/local/bin/ enve + "https://github.com/joseluisq/enve/releases/download/v1.4.2/enve_v1.4.2_linux_amd64.tar.gz" \ + | sudo tar zxf - -C /usr/local/bin/ enve ``` Using Go: @@ -28,7 +28,7 @@ Release binaries also available on [joseluisq/enve/releases](https://github.com/ ## Usage -By default **enve** will print all environment variables like `env` command. +By default, **enve** will print all environment variables like `env` command. ```sh enve @@ -38,7 +38,7 @@ enve --output text ### Executing commands -By default, an optional `.env` file can be loaded from current working directory. +By default, an optional `.env` file can be loaded from the current working directory. ```sh enve test.sh @@ -63,7 +63,7 @@ enve --output xml ## Options ``` -$ enve 1.4.1 +$ enve 1.4.2 Run a program in a modified environment using .env files USAGE: @@ -80,10 +80,10 @@ OPTIONS: Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions. -Feel free to send some [Pull request](https://github.com/joseluisq/enve/pulls) or [issue](https://github.com/joseluisq/enve/issues). +Feel free to send some [Pull request](https://github.com/joseluisq/enve/pulls) or file an [issue](https://github.com/joseluisq/enve/issues). ## License This work is primarily distributed under the terms of both the [MIT license](LICENSE-MIT) and the [Apache License (Version 2.0)](LICENSE-APACHE). -© 2020-present [Jose Quintana](https://git.io/joseluisq) +© 2020-present [Jose Quintana](https://joseluisq.net) diff --git a/cmd/cmd.go b/cmd/cmd.go index bf79c0f..ae663e2 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -15,6 +15,7 @@ import ( var ( versionNumber string = "devel" buildTime string + buildCommit string ) // Environment defines JSON/XML data structure @@ -32,6 +33,7 @@ func Execute() { app.Summary = "Run a program in a modified environment using .env files" app.Version = versionNumber app.BuildTime = buildTime + app.BuildCommit = buildCommit app.Flags = []cli.Flag{ cli.FlagString{ Name: "file",