From 2381a305a0bc38ad42727239980e7be1088b79d8 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 7 Mar 2024 20:01:03 +0100 Subject: [PATCH] .github/workflows/release.yml: build musl linked binaries. --- .github/workflows/release.yml | 57 ++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5867d10..d571cf6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,6 +59,61 @@ jobs: asset_path: build/bundle.tar.gz asset_content_type: application/tar+gzip + # Build thalos binaries that are linked with musl libc. + musl: + strategy: + fail-fast: false + matrix: + arch: [ 386, amd64, arm, arm64 ] + runs-on: ubuntu-latest + name: Build musl (${{ matrix.arch }}) + container: + image: golang:1.21-alpine3.19" + steps: + - uses: actions/checkout@v4 + + - name: install build + run: apk add make + + - name: compile + id: compile + run: | + mkdir -p build/bundle/{bin,logs} + GOARCH=${{matrix.arch}} make -e DESTDIR=build/bundle PREFIX= CFGDIR= install install-scripts + tar -C build/bundle -z -cf build/bundle.tar.gz . + echo "version=$(sed -n 's/.*PROGRAM_VERSION\s*=\s*//p' Makefile)" >> "$GITHUB_OUTPUT" + + - name: Upload thalos-server + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_name: thalos-server-${{steps.compile.outputs.version}}-linux-${{matrix.arch}}-musl + asset_path: build/thalos-server + asset_content_type: application/octal-stream + + - name: Upload thalos-tools + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_name: thalos-tools-${{steps.compile.outputs.version}}-linux-${{matrix.arch}}-musl + asset_path: build/thalos-tools + asset_content_type: application/octal-stream + + - name: Upload bundle + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_name: thalos-${{steps.compile.outputs.version}}-linux-${{matrix.arch}}-musl.tar.gz + asset_path: build/bundle.tar.gz + asset_content_type: application/tar+gzip + + package-ubuntu: strategy: fail-fast: false @@ -121,4 +176,4 @@ jobs: upload_url: ${{ github.event.release.upload_url }} asset_name: ${{ steps.package.outputs.info_name }} asset_path: ${{ steps.package.outputs.info_filename }} - asset_content_type: text/plain \ No newline at end of file + asset_content_type: text/plain