Skip to content

qbt-musl-cross-make - build and release #322

qbt-musl-cross-make - build and release

qbt-musl-cross-make - build and release #322

name: qbt-musl-cross-make - build and release
on:
workflow_dispatch:
inputs:
docker_only:
description: "Docker job only"
required: true
default: false
type: boolean
jobs:
bootstrap-matrix:
runs-on: ubuntu-latest
outputs:
matrix_includes: ${{ steps.triples.outputs.matrix_includes }}
steps:
- uses: actions/checkout@v4
- name: bootstrap the matrix
id: triples
run: echo "matrix_includes=$(jq -c . triples.json)" >> $GITHUB_OUTPUT
build:
if: inputs.docker_only == '0'
needs: bootstrap-matrix
runs-on: ubuntu-latest
container:
image: alpine:edge
permissions:
contents: write
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.bootstrap-matrix.outputs.matrix_includes) }}
name: build ${{ matrix.arch_type }}
steps:
- uses: actions/checkout@v4
- name: apk update
run: apk update
- name: apk install build deps
run: >
apk add -u --no-cache
autoconf automake
bash bison build-base
curl
findutils flex
git
libarchive-tools libtool linux-headers
patch perl pkgconf
rsync
tar texinfo
xz
zip
- name: Set ${{ matrix.arch_type }} musl to ${{ matrix.arch_config }}
run: sed "s|GCC_CONFIG_FOR_TARGET +=|GCC_CONFIG_FOR_TARGET += ${{ matrix.arch_config }}|" -i config.mak
- name: Disable binutils gold for loongarch64
if: matrix.arch_type == 'loongarch64-linux-musl'
run: sed "s| --enable-gold=yes||" -i config.mak
- name: Show updated config.mak
run: cat config.mak
- name: install ${{ matrix.arch_type }} toolchain
run: make -j"$(nproc)" install TARGET="${{ matrix.arch_type }}" OUTPUT="$(pwd)/build/${{ matrix.arch_type }}"
- name: archive ${{ matrix.arch_type }} toolchain
run: |
cd "$(pwd)/build"
XZ_OPT=-9T0 tar -cvJf ${{ matrix.arch_type }}.tar.xz ${{ matrix.arch_type }}/
- name: Docker - upload artifacts
uses: actions/upload-artifact@v4
with:
name: "qbt-musl-cross-make-${{ matrix.arch_type }}"
path: "build/${{ matrix.arch_type }}.tar.xz"
release:
name: Upload artifacts to release
runs-on: ubuntu-latest
needs: [bootstrap-matrix, build]
permissions:
contents: write
if: always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && inputs.docker_only == '0'
env:
GH_TOKEN: "${{ github.TOKEN }}"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Host - Download artifacts
uses: actions/download-artifact@v4
with:
path: qbt-musl-cross-make
pattern: qbt-musl-cross-make-*
merge-multiple: true
- name: set release info from versions.mak
run: |
cp -f versions.mak release_body.md
jq -R 'split(" = ") | {(.[0]):.[1]}' versions.mak | jq -s 'add' > versions.json
- name: set tag via date
run: echo "github_tag=$(date +"%y%V")" >> $GITHUB_ENV
- name: Create release - tag - assets
uses: ncipollo/release-action@v1
with:
prerelease: false
artifacts: "qbt-musl-cross-make/*.tar.xz,versions.json"
replacesArtifacts: true
tag: "${{ env.github_tag }}"
name: "qbt-musl-cross-make toolchains"
bodyFile: release_body.md
allowUpdates: true
docker-publish:
if: always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
needs: [bootstrap-matrix, build, release]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.bootstrap-matrix.outputs.matrix_includes) }}
name: docker ${{ matrix.arch_type }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract metadata (tags, labels) for Docker
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
file: Dockerfile
push: true
no-cache: true
tags: ghcr.io/${{ github.repository }}:${{ matrix.arch_type }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
TARGET=${{ matrix.arch_type }}
BASE_URL=https://github.com/userdocs/qbt-musl-cross-make/releases/latest/download
NINJA_URL=https://github.com/userdocs/qbt-ninja-build/releases/latest/download/ninja-x86_64