2022-11-15 15:15:07 +08:00
|
|
|
name: Publish Milvus Base Image
|
|
|
|
# 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/milvus/ubuntu20.04/Dockerfile.base'
|
|
|
|
- '.github/workflows/publish-milvus-base.yaml'
|
|
|
|
pull_request:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
|
|
|
- 'build/docker/milvus/ubuntu20.04/Dockerfile.base'
|
|
|
|
- '.github/workflows/publish-milvus-base.yaml'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-milvus-base:
|
|
|
|
name: milvus-base-ubuntu20.04
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
OS_NAME: ubuntu20.04
|
|
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Generate docker image tag name
|
|
|
|
id: generate-tag-name
|
|
|
|
run: |
|
|
|
|
export tag=$(date +%Y%m%d)-$(git rev-parse --short HEAD)
|
|
|
|
echo $tag
|
|
|
|
echo "::set-output name=docker_tag::$tag"
|
|
|
|
- name: Docker Build
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
docker build -f "./build/docker/milvus/${OS_NAME}/Dockerfile.base" -t "milvusdb/milvus-base:${{ steps.generate-tag-name.outputs.docker_tag }}" .
|
|
|
|
|
|
|
|
- name: Docker login
|
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
|
|
|
uses: azure/docker-login@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Docker Push
|
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
|
|
|
continue-on-error: false
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
docker push milvusdb/milvus-base:${{ steps.generate-tag-name.outputs.docker_tag }}
|
|
|
|
- name: Update Milvus Base Image Changes
|
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-11-16 14:21:14 +08:00
|
|
|
sed -i "s#MILVUS_BASE_IMAGE_TAG=.*#MILVUS_BASE_IMAGE_TAG=\"${{ steps.generate-tag-name.outputs.docker_tag }}\"#g" build/docker/milvus/ubuntu20.04/Dockerfile
|
2022-11-15 15:15:07 +08:00
|
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
git add build/docker/milvus/ubuntu20.04/Dockerfile
|
|
|
|
git commit -m "Update Milvus base image tag"
|
|
|
|
- name: Create Pull Request
|
|
|
|
id: cpr
|
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
|
|
|
continue-on-error: true
|
|
|
|
uses: peter-evans/create-pull-request@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
|
|
|
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
|
|
signoff: true
|
|
|
|
branch: update_base_${{ github.sha }}
|
|
|
|
delete-branch: true
|
|
|
|
title: '[automated] Update Milvus Base image Tag'
|
|
|
|
body: |
|
|
|
|
Update Update Milvus Base image Tag
|
|
|
|
See changes: https://github.com/milvus-io/milvus/commit/${{ github.sha }}
|
|
|
|
Signed-off-by: ${{ github.actor }} ${{ github.actor }}@users.noreply.github.com
|
|
|
|
- name: Check outputs
|
2022-11-16 14:21:14 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
2022-11-15 15:15:07 +08:00
|
|
|
run: |
|
|
|
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
|
|
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|