2023-11-30 15:58:32 +08:00
|
|
|
name: Publish Gpu 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/gpu/**'
|
|
|
|
- '.github/workflows/publish-gpu-builder.yaml'
|
|
|
|
- '!**.md'
|
|
|
|
pull_request:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
|
|
|
- 'build/docker/builder/gpu/**'
|
|
|
|
- '.github/workflows/publish-gpu-builder.yaml'
|
|
|
|
- '!**.md'
|
|
|
|
|
2023-12-14 11:30:38 +08:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
2024-01-09 18:28:48 +08:00
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
2023-12-14 11:30:38 +08:00
|
|
|
|
2023-11-30 15:58:32 +08:00
|
|
|
jobs:
|
|
|
|
publish-gpu-builder:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 500
|
|
|
|
env:
|
2024-04-05 10:09:22 +08:00
|
|
|
OS: ubuntu22.04
|
2023-11-30 15:58:32 +08:00
|
|
|
steps:
|
2023-12-04 10:10:35 +08:00
|
|
|
- name: Maximize build space
|
|
|
|
uses: easimon/maximize-build-space@master
|
2023-12-14 17:44:39 +08:00
|
|
|
if: ${{ ! startsWith(runner.name, 'self') }} # skip this step if it is self-hosted runner
|
2023-12-04 10:10:35 +08:00
|
|
|
with:
|
|
|
|
root-reserve-mb: 20480
|
|
|
|
# overprovision-lvm: 'true'
|
|
|
|
swap-size-mb: 1024
|
|
|
|
remove-dotnet: 'true'
|
|
|
|
remove-android: 'true'
|
|
|
|
remove-haskell: 'true'
|
2023-11-30 15:58:32 +08:00
|
|
|
- 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)"
|
2024-01-08 10:10:47 +08:00
|
|
|
echo "::set-output name=sha_short::$(git rev-parse --short=7 HEAD)"
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
milvusdb/milvus-env
|
|
|
|
tags: |
|
2024-04-09 10:57:24 +08:00
|
|
|
type=raw,enable=true,value=gpu-${{ env.OS }}-{{date 'YYYYMMDD'}}-{{sha}}
|
|
|
|
type=raw,enable=true,value=gpu-${{ env.OS }}-latest
|
2023-11-30 15:58:32 +08:00
|
|
|
# - name: Setup upterm session
|
|
|
|
# uses: lhotari/action-upterm@v1
|
2024-04-05 10:09:22 +08:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
with:
|
|
|
|
platforms: arm64
|
2024-01-08 10:10:47 +08:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
2024-04-05 10:09:22 +08:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2024-01-08 10:10:47 +08:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2024-04-05 10:09:22 +08:00
|
|
|
file: build/docker/builder/gpu/${{ env.OS }}/Dockerfile
|
2024-01-03 19:46:50 +08:00
|
|
|
- name: Bump Builder Version
|
2024-04-05 10:09:22 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && ${{ env.OS == 'ubuntu22.04' }}
|
2024-01-03 19:46:50 +08:00
|
|
|
uses: ./.github/actions/bump-builder-version
|
2023-11-30 15:58:32 +08:00
|
|
|
with:
|
2024-01-03 19:46:50 +08:00
|
|
|
tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}"
|
|
|
|
type: gpu
|
2024-01-08 10:10:47 +08:00
|
|
|
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
|