From 0dbea0f0d664464399648a82da03bccc492ee02e Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Sat, 22 Apr 2023 21:57:33 +0200 Subject: [PATCH] fix(ci): release container tarball --- .releaserc.yml | 8 +++++++- Makefile | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.releaserc.yml b/.releaserc.yml index 3dba357..ee6a628 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -4,4 +4,10 @@ branches: plugins: - "@semantic-release/commit-analyzer" - "@semantic-release/release-notes-generator" - - "@semantic-release/github" + - - "@semantic-release/exec" + - prepareCmd: "make build-container-tarball VERSION=${nextRelease.version}" + - - "@semantic-release/github" + - assets: + - path: "target/sonic_exporter.tar.gz" + label: "Container tarball" + diff --git a/Makefile b/Makefile index 0f2e8f9..385e235 100644 --- a/Makefile +++ b/Makefile @@ -11,3 +11,8 @@ LDFLAGS = -ldflags "-X main.Version=${VERSION} -X main.GitHash=${GIT_HASH} -X ma build: CGO_ENABLED=0 go build ${LDFLAGS} -v -o target/sonic_exporter . +.PHONY: build-container-tarball +build-container-tarball: + docker build -t sonic_exporter . + docker image save sonic_exporter -o target/sonic_exporter.tar + gzip target/sonic_exporter.tar