Package #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package | ||
on: | ||
release: | ||
types: [ created ] | ||
jobs: | ||
cross-compile: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ linux, freebsd ] | ||
arch: [ 386, amd64, arm, arm64 ] | ||
name: Crosscompile - ${{matrix.os}}-${{matrix.arch}} | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21 | ||
- name: compile | ||
id: compile | ||
run: | | ||
mkdir -p build/bundle/{bin,logs} | ||
GOOS=${{matrix.os}} 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}}-${{matrix.os}}-${{matrix.arch}} | ||
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}}-${{matrix.os}}-${{matrix.arch}} | ||
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}}-${{matrix.os}}-${{matrix.arch}}.tar.gz | ||
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 | ||
matrix: | ||
os: [ ubuntu-22.04 ] | ||
name: Package - ${{matrix.os}} | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21 | ||
- name: Install build dependencies | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install build-essential fakeroot debhelper quilt | ||
- name: Package | ||
id: package | ||
run: | | ||
make build-deb | ||
DEB_FILE=$(ls ../*.deb | head -1) | ||
echo "deb_filename=$DEB_FILE" >> "$GITHUB_OUTPUT" | ||
echo "deb_name=$(basename $DEB_FILE)" >> "$GITHUB_OUTPUT" | ||
CH_FILE=$(ls ../*.changes | head -1) | ||
echo "ch_filename=$CH_FILE" >> "$GITHUB_OUTPUT" | ||
echo "ch_name=$(basename $CH_FILE)" >> "$GITHUB_OUTPUT" | ||
INFO_FILE=$(ls ../*.buildinfo | head -1) | ||
echo "info_filename=$INFO_FILE" >> "$GITHUB_OUTPUT" | ||
echo "info_name=$(basename $INFO_FILE)" >> "$GITHUB_OUTPUT" | ||
- name: Upload (package) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_name: ${{ steps.package.outputs.deb_name }} | ||
asset_path: ${{ steps.package.outputs.deb_filename }} | ||
asset_content_type: application/x-deb | ||
- name: Upload (.changes) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_name: ${{ steps.package.outputs.ch_name }} | ||
asset_path: ${{ steps.package.outputs.ch_filename }} | ||
asset_content_type: text/plain | ||
- name: Upload (buildinfo) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
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 |