Skip to content

Commit

Permalink
.github/workflows/release.yml: build musl linked binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnx committed Mar 7, 2024
1 parent 2d6d4e8 commit 9c8bbd3
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 dependencies
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
Expand Down Expand Up @@ -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
asset_content_type: text/plain

0 comments on commit 9c8bbd3

Please sign in to comment.