DockerCLI/.github/workflows/build.yml

82 lines
1.8 KiB
YAML
Raw Normal View History

name: build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]{2}'
tags:
- 'v*'
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target:
- cross
- dynbinary-cross
use_glibc:
- ""
- glibc
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Run ${{ matrix.target }}
uses: docker/bake-action@v2
with:
targets: ${{ matrix.target }}
env:
USE_GLIBC: ${{ matrix.use_glibc }}
-
name: Flatten artifacts
working-directory: ./build
run: |
for dir in */; do
base=$(basename "$dir")
echo "Creating ${base}.tar.gz ..."
tar -cvzf "${base}.tar.gz" "$dir"
rm -rf "$dir"
done
if [ -z "${{ matrix.use_glibc }}" ]; then
echo "ARTIFACT_NAME=${{ matrix.target }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=${{ matrix.target }}-glibc" >> $GITHUB_ENV
fi
-
name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./build/*
if-no-files-found: error
plugins:
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build plugins
uses: docker/bake-action@v2
with:
targets: plugins-cross