From cdf4286663b302af22d729ce304be2d7e8d405a3 Mon Sep 17 00:00:00 2001 From: Alexej Disterhoft Date: Sat, 30 Dec 2023 12:20:45 +0100 Subject: [PATCH] ci(build): multi-arch and multi-os build Signed-off-by: Alexej Disterhoft --- .github/workflows/ci.yaml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2146669..7b8408e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,6 +49,16 @@ jobs: build: runs-on: ubuntu-latest + + strategy: + matrix: + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + steps: - name: Checkout uses: actions/checkout@v4 @@ -66,18 +76,24 @@ jobs: go-version-file: ./go.mod - name: Build - run: go build -buildvcs=true -o ./bin/kubectl-mapr-ticket ./cmd/ + run: go build -buildvcs=true -o ./bin/${{ matrix.goarch }}/${{ matrix.goos }}/kubectl-mapr-ticket ./cmd/kubectl-mapr-ticket env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 - - name: Run and print version - run: ./bin/kubectl-mapr-ticket version + - name: Compress + run: | + tar -czvf \ + ./kubectl-mapr-ticket-${{ matrix.goarch }}-${{ matrix.goos }}.tar.gz \ + -C ./bin/${{ matrix.goarch }}/${{ matrix.goos }}/ \ + kubectl-mapr-ticket - name: Upload artifact if: contains(github.ref, 'tags') uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ steps.token.outputs.token }} - file: ./bin/kubectl-mapr-ticket + file: ./kubectl-mapr-ticket-${{ matrix.goarch }}-${{ matrix.goos }}.tar.gz tag: ${{ github.ref }} overwrite: true