From e71a698937a4b0cf8d27bc64baa5bd700f01d017 Mon Sep 17 00:00:00 2001 From: Suraj Shirvankar Date: Mon, 29 Jul 2024 15:17:02 +0200 Subject: [PATCH] ci: build binaries using goreleaser Signed-off-by: Suraj Shirvankar --- .github/workflows/binaries.yaml | 34 +++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 5 ++++- .gitignore | 2 ++ .goreleaser.yaml | 25 ++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/binaries.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml new file mode 100644 index 00000000..a482f6fc --- /dev/null +++ b/.github/workflows/binaries.yaml @@ -0,0 +1,34 @@ +name: binaries + +on: + workflow_call: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.19' + cache-dependency-path: sztp-agent/go.sum + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5cd72074..180f7ea7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,5 +7,8 @@ on: jobs: release-docker: - uses: ./.github/workflows/sztp.yml + uses: ./.github/workflows/sztp.yaml + secrets: inherit + release-binaries: + uses: ./.github/workflows/binaries.yaml secrets: inherit diff --git a/.gitignore b/.gitignore index 66fd13c9..5800750a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..c55190a1 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,25 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +gomod: + dir: ./sztp-agent/ + +builds: + - dir: ./sztp-agent/ + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + +changelog: + sort: asc