From f7efbcb4c227a43a32933691c96f2d0144221294 Mon Sep 17 00:00:00 2001 From: Jean-Hadrien Chabran Date: Fri, 15 Mar 2024 12:59:30 +0100 Subject: [PATCH] feat/ci: ship a static variant of sg linux/amd64 on (#61191) feat/ci: ship a static variant of sg linux/amd64 --- .github/workflows/sg-binary-release.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/sg-binary-release.yml b/.github/workflows/sg-binary-release.yml index f652f9ad36a..c275eedd16e 100644 --- a/.github/workflows/sg-binary-release.yml +++ b/.github/workflows/sg-binary-release.yml @@ -115,6 +115,10 @@ jobs: GOARCH=${{ matrix.arch }} go build -o "sg_$(go env GOOS)_${{ matrix.arch }}" -trimpath -ldflags "-s -w -X main.BuildCommit=$(git rev-list -1 HEAD .)" . GOARCH=${{ matrix.arch }} go build -o "sg-msp_$(go env GOOS)_${{ matrix.arch }}" -tags=msp -trimpath -ldflags "-s -w -X main.BuildCommit=$(git rev-list -1 HEAD .)" . + # On certain CI agents, the glibc might not be the right one, so we build a static variant + CGO_ENABLED=0 GOARCH=${{ matrix.arch }} go build -o "sg_$(go env GOOS)_${{ matrix.arch }}_static" -trimpath -ldflags "-s -w -X main.BuildCommit=$(git rev-list -1 HEAD .)" . + CGO_ENABLED=0 GOARCH=${{ matrix.arch }} go build -o "sg-msp_$(go env GOOS)_${{ matrix.arch }}_static" -tags=msp -trimpath -ldflags "-s -w -X main.BuildCommit=$(git rev-list -1 HEAD .)" . + - name: Upload release asset run: | cd dev/sg @@ -125,6 +129,17 @@ jobs: repo: sourcegraph/sg GITHUB_TOKEN: ${{ secrets.SG_RELEASE_TOKEN }} + - name: Upload release asset (linux-amd64-static) + if: startswith(matrix.os, 'ubuntu-') == true + run: | + cd dev/sg + release_name="${{ needs.create_release.outputs.release_name }}" + gh release upload -R="${repo}" ${release_name} "sg_$(go env GOOS)_${{ matrix.arch }}_static" + gh release upload -R="${repo}" ${release_name} "sg-msp_$(go env GOOS)_${{ matrix.arch }}_static" + env: + repo: sourcegraph/sg + GITHUB_TOKEN: ${{ secrets.SG_RELEASE_TOKEN }} + report_failure: needs: build if: ${{ failure() }}