diff --git a/.github/workflows/go-application.yml b/.github/workflows/go-application.yml index 169e88c..a65e66c 100644 --- a/.github/workflows/go-application.yml +++ b/.github/workflows/go-application.yml @@ -4,11 +4,13 @@ on: push: branches: - master + - v1 tags: - "*" pull_request: branches: - master + - v1 env: TAG_NAME: "${GITHUB_REF##*/}" @@ -162,6 +164,31 @@ jobs: name: logstash-exporter-linux path: out/main-linux + build-linux-arm: + name: Build Linux ARM binary + runs-on: ubuntu-20.04 + needs: [lint, test] + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Golang with cache + uses: magnetikonline/action-golang-cache@v4 + with: + go-version: "^1.21" + + - name: Build Linux ARM binary + run: make build-linux-arm + env: + VERSION: ${{ github.ref }} + + - name: Upload Linux ARM binary + uses: actions/upload-artifact@v3 + with: + name: logstash-exporter-linux-arm + path: out/main-linux-arm + build-darwin: name: Build Mac binary runs-on: ubuntu-20.04 @@ -369,13 +396,14 @@ jobs: upload-binaries: strategy: matrix: - binary: [linux, darwin, windows] + binary: [linux, darwin, windows, linux-arm] runs-on: ubuntu-20.04 needs: - create-release - build-linux - build-darwin - build-windows + - build-linux-arm if: startsWith(github.ref, 'refs/tags/') steps: - name: Download binary diff --git a/Makefile b/Makefile index 14b3ad5..2019bb9 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,9 @@ build-linux: out/main-linux build-darwin: out/main-darwin #: Builds a binary executable for Windows build-windows: out/main-windows +#: Builds a binary executable for Linux ARM +build-linux-arm: + CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -a -installsuffix cgo -ldflags="$(ldflags)" -o out/main-linux-arm cmd/exporter/main.go #: Builds a Docker image for the Go Exporter application build-docker: