Skip to content

Commit

Permalink
chore: bump goreleaser (#290)
Browse files Browse the repository at this point in the history
* chore: bump goreleaser

Signed-off-by: Bence Csati <[email protected]>

* chore: update flake

Signed-off-by: Bence Csati <[email protected]>

* chore: add version

Signed-off-by: Bence Csati <[email protected]>

* chore: change version to dev

Signed-off-by: Bence Csati <[email protected]>

---------

Signed-off-by: Bence Csati <[email protected]>
  • Loading branch information
csatib02 authored Jul 19, 2024
1 parent eda3e8a commit 4ac8ce6
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
with:
cond: ${{ inputs.release }}
if_true: goreleaser release
if_false: goreleaser release --skip-publish --snapshot
if_false: goreleaser release --skip=publish --snapshot

- name: Build
run: nix develop --impure .#ci -c ${{ steps.build-command.outputs.value }}
Expand Down
30 changes: 20 additions & 10 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
version: 2

project_name: vault-env

dist: build/dist

before:
hooks:
- go mod tidy
builds:
- main: .
env:
- env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags: "-s -w -X main.version={{ .Version }}"
ldflags: "-s -w -X main.Version={{ .Version }}"
main: .
goos:
- linux
- darwin
Expand All @@ -15,13 +20,18 @@ builds:
- arm64

archives:
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format_overrides:
- goos: windows
format: zip
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
checksum:
name_template: "checksums.txt"

changelog:
skip: false
disable: true
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ container-image: ## Build container image

.PHONY: binary-snapshot
binary-snapshot: ## Build binary snapshot
$(GORELEASER_BIN) release --rm-dist --skip-publish --snapshot
VERSION=v${GORELEASER_VERSION} ${GORELEASER_BIN} release --clean --skip=publish --snapshot

.PHONY: artifacts
artifacts: container-image binary-snapshot
Expand Down Expand Up @@ -84,7 +84,7 @@ deps: ## Install dependencies
GOLANGCI_VERSION = 1.53.3
COSIGN_VERSION = 2.2.2
LICENSEI_VERSION = 0.8.0
GORELEASER_VERSION = 1.18.2
GORELEASER_VERSION = 2.0.0

# Dependency binaries
GOLANGCI_LINT_BIN := golangci-lint
Expand Down Expand Up @@ -127,4 +127,6 @@ bin/cosign:


bin/goreleaser:
scripts/get-goreleaser.sh
@mkdir -p bin
curl -sfL https://goreleaser.com/static/run -o bin/goreleaser
@chmod +x bin/goreleaser
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 7 additions & 45 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
description = "Go libraries for interacting with Hashicorp Vault";

inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devenv.url = "github:cachix/devenv";
};
Expand Down Expand Up @@ -40,16 +39,20 @@
packages = with pkgs; [
gnumake

# golangci-lint
goreleaser

# golangci-lint
# TODO: remove once https://github.com/NixOS/nixpkgs/pull/254878 hits unstable
(golangci-lint.override (prev: {
buildGoModule = pkgs.buildGo121Module;
}))

kubectl

yamllint
hadolint
] ++ [
self'.packages.licensei
self'.packages.golangci-lint
];

env = {
Expand Down Expand Up @@ -116,47 +119,6 @@
"-X github.com/hashicorp/vault/sdk/version.VersionPrerelease="
];
};

golangci-lint = pkgs.buildGo121Module rec {
pname = "golangci-lint";
version = "1.54.2";

src = pkgs.fetchFromGitHub {
owner = "golangci";
repo = "golangci-lint";
rev = "v${version}";
hash = "sha256-7nbgiUrp7S7sXt7uFXX8NHYbIRLZZQcg+18IdwAZBfE=";
};

vendorHash = "sha256-IyH5lG2a4zjsg/MUonCUiAgMl4xx8zSflRyzNgk8MR0=";

subPackages = [ "cmd/golangci-lint" ];

nativeBuildInputs = [ pkgs.installShellFiles ];

ldflags = [
"-s"
"-w"
"-X main.version=${version}"
"-X main.commit=v${version}"
"-X main.date=19700101-00:00:00"
];

postInstall = ''
for shell in bash zsh fish; do
HOME=$TMPDIR $out/bin/golangci-lint completion $shell > golangci-lint.$shell
installShellCompletion golangci-lint.$shell
done
'';

meta = with pkgs.lib; {
description = "Fast linters Runner for Go";
homepage = "https://golangci-lint.run/";
changelog = "https://github.com/golangci/golangci-lint/blob/v${version}/CHANGELOG.md";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ anpryl manveru mic92 ];
};
};
};
};
};
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import (
"github.com/spf13/cast"
)

var Version = "dev"

// The special value for VAULT_ENV which marks that the login token needs to be passed through to the application
// which was acquired during the new Vault client creation
const vaultLogin = "vault:login"
Expand Down
66 changes: 0 additions & 66 deletions scripts/get-goreleaser.sh

This file was deleted.

0 comments on commit 4ac8ce6

Please sign in to comment.