From d822a6ce32e8fcad73f093306e24f46c7754a07c Mon Sep 17 00:00:00 2001 From: Carl Montanari Date: Fri, 29 Mar 2024 13:12:52 -0700 Subject: [PATCH 1/2] feat: first pass at go releaser bits for clabverter --- .github/workflows/release.yaml | 22 +++++++++++++++++++++ .gitignore | 3 +++ .goreleaser.yaml | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8e5bc111..a00eadd6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -79,3 +79,25 @@ jobs: helm package charts/clabernetes --version $RELEASE_VERSION helm push clabernetes-$RELEASE_VERSION.tgz oci://ghcr.io/srl-labs/clabernetes + + - name: run goreleaser to build clabverter/checksums + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # simply use gh cli to upload since we dont actually want an action that makes the release + # for us, just wanna upload assets + - name: upload clabverter binaries (and checksums) to the release + run: | + cd .dist + gh release upload ${{ github.ref_name }} checksums.txt + for filename in *.tar.gz; do + [ -e "$filename" ] || continue + gh release upload ${{ github.ref_name }} "$filename" + done + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash diff --git a/.gitignore b/.gitignore index 31136a3d..445b66b7 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ cover.out # direnv file .envrc + +# goreleaser dist dir for testing builds and such locally +.dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..067d3e83 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,35 @@ +--- +version: 1 + +dist: ./.dist + +checksum: + name_template: checksums.txt + +builds: + - id: clabverter + binary: clabverter + main: ./cmd/clabverter/main.go + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + format_overrides: + - goos: windows + format: zip + +# we just wanna build/archive w/ goreleaser, disable changelog/release bits +changelog: + disable: true +release: + disable: true \ No newline at end of file From a2d845c376082085f16ba3044ab22da5d04ddc00 Mon Sep 17 00:00:00 2001 From: Carl Montanari Date: Mon, 1 Apr 2024 06:24:32 -0700 Subject: [PATCH 2/2] chore: set goreleaser version in ci env --- .github/vars.env | 3 ++- .github/workflows/release.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/vars.env b/.github/vars.env index 4ea766b5..b2f8a255 100644 --- a/.github/vars.env +++ b/.github/vars.env @@ -5,4 +5,5 @@ GOFUMPT_VERSION=v0.6.0 GOLANGCI_LINT_VERSION=v1.57.1 GOLINES_VERSION=v0.12.2 GOTESTSUM_VERSION=v1.11.0 -HELM_VERSION=v3.14.2 \ No newline at end of file +HELM_VERSION=v3.14.2 +GORELEASER_VERSION=v1.24.0 \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a00eadd6..84e24f08 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,6 +35,7 @@ jobs: echo "GOLINES_VERSION=$GOLINES_VERSION" >> "$GITHUB_ENV" echo "GOTESTSUM_VERSION=$GOTESTSUM_VERSION" >> "$GITHUB_ENV" echo "HELM_VERSION=$HELM_VERSION" >> "$GITHUB_ENV" + echo "GORELEASER_VERSION=$GORELEASER_VERSION" >> "$GITHUB_ENV" - name: install devspace run: | @@ -83,7 +84,7 @@ jobs: - name: run goreleaser to build clabverter/checksums uses: goreleaser/goreleaser-action@v5 with: - version: latest + version: ${{ env.GORELEASER_VERSION }} args: release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}