feat/ci: ship a static variant of sg linux/amd64 on (#61191)

feat/ci: ship a static variant of sg linux/amd64
This commit is contained in:
Jean-Hadrien Chabran 2024-03-15 12:59:30 +01:00 committed by GitHub
parent 532d79b296
commit f7efbcb4c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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() }}