milvus/.github/workflows/publish-builder.yaml
sammy.huang acbbabf043
enhance: [skip e2e]abstract bump builder version into a composite action (#29573)
fix: #29608

Signed-off-by: Sammy Huang <sammy.huang@zilliz.com>
2024-01-03 19:46:50 +08:00

83 lines
3.4 KiB
YAML

name: Publish Builder
# TODO: do not trigger action for some document file update
# This workflow is triggered on pushes or pull request to the repository.
on:
push:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'build/docker/builder/cpu/**'
- '.github/workflows/publish-builder.yaml'
- '!**.md'
pull_request:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'build/docker/builder/cpu/**'
- '.github/workflows/publish-builder.yaml'
- '!**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
publish-builder:
name: ${{ matrix.arch }} ${{ matrix.os }}
runs-on: ubuntu-latest
timeout-minutes: 500
strategy:
fail-fast: false
matrix:
os: [ubuntu20.04, amazonlinux2023]
arch: [amd64&arm64]
env:
OS_NAME: ${{ matrix.os }}
IMAGE_ARCH: ${{ matrix.arch }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
if: ${{ ! startsWith(runner.name, 'self') }} # skip this step if it is self-hosted runner
with:
root-reserve-mb: 20480
# overprovision-lvm: 'true'
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
- name: Checkout
uses: actions/checkout@v2
- name: Get version from system time after release step
id: extracter
run: |
echo "::set-output name=version::$(date +%Y%m%d)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build
if: success() && github.event_name == 'pull_request' && github.repository == 'milvus-io/milvus'
shell: bash
run: |
docker buildx ls
docker buildx build --platform linux/amd64,linux/arm64 -t milvusdb/milvus-env:${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
- name: Docker Build&Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
shell: bash
run: |
docker buildx ls
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
docker buildx build --platform linux/amd64,linux/arm64 --push -t milvusdb/milvus-env:${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
docker buildx build --platform linux/amd64,linux/arm64 --push -t milvusdb/milvus-env:${OS_NAME}-latest -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
- name: Bump Builder Version
uses: ./.github/actions/bump-builder-version
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
with:
tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}"
type: cpu
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}