2020-11-02 10:42:09 +08:00
|
|
|
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:
|
2023-03-20 19:03:57 +08:00
|
|
|
- 'build/docker/builder/cpu/**'
|
2020-11-02 10:42:09 +08:00
|
|
|
- '.github/workflows/publish-builder.yaml'
|
2021-07-09 14:08:00 +08:00
|
|
|
- '!**.md'
|
2020-11-02 10:42:09 +08:00
|
|
|
pull_request:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
2023-03-20 19:03:57 +08:00
|
|
|
- 'build/docker/builder/cpu/**'
|
2020-11-02 10:42:09 +08:00
|
|
|
- '.github/workflows/publish-builder.yaml'
|
2021-07-09 14:08:00 +08:00
|
|
|
- '!**.md'
|
2020-11-02 10:42:09 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-builder:
|
2021-07-08 15:43:45 +08:00
|
|
|
name: AMD64 ${{ matrix.os }}
|
2020-11-02 10:42:09 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-08-25 21:24:55 +08:00
|
|
|
os: [ubuntu18.04, ubuntu20.04, centos7]
|
2020-11-02 10:42:09 +08:00
|
|
|
env:
|
2021-07-08 15:43:45 +08:00
|
|
|
OS_NAME: ${{ matrix.os }}
|
2020-11-02 10:42:09 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2020-11-02 18:49:11 +08:00
|
|
|
- name: Get version from system time after release step
|
|
|
|
id: extracter
|
2022-04-01 14:25:29 +08:00
|
|
|
run: |
|
2022-06-06 15:24:06 +08:00
|
|
|
echo "::set-output name=version::$(date +%Y%m%d)"
|
|
|
|
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
2020-11-17 15:06:48 +08:00
|
|
|
- name: Docker Pull
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-08-01 16:14:25 +08:00
|
|
|
docker-compose pull --ignore-pull-failures builder
|
2020-11-02 10:42:09 +08:00
|
|
|
- name: Docker Build
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-04-01 14:25:29 +08:00
|
|
|
DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose build builder
|
|
|
|
export LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
|
2021-08-01 16:14:25 +08:00
|
|
|
DATE_VERSION=latest docker-compose build builder
|
2020-11-02 10:42:09 +08:00
|
|
|
- name: Docker Push
|
2021-04-26 13:59:28 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
2020-11-02 10:42:09 +08:00
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
docker login -u ${{ secrets.DOCKERHUB_USER }} \
|
|
|
|
-p ${{ secrets.DOCKERHUB_TOKEN }}
|
2022-04-01 14:25:29 +08:00
|
|
|
DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose push builder
|
2021-08-01 16:14:25 +08:00
|
|
|
DATE_VERSION=latest docker-compose push builder
|
2021-07-12 17:06:18 +08:00
|
|
|
- name: Update Builder Image Changes
|
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-04-01 14:25:29 +08:00
|
|
|
sed -i "s#^DATE_VERSION=.*#DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
|
|
|
|
sed -i "s#^LATEST_DATE_VERSION=.*#LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
|
2021-07-12 17:06:18 +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 .env
|
2021-07-13 16:06:26 +08:00
|
|
|
git commit -m "Update Builder image changes"
|
2021-07-13 15:12:27 +08:00
|
|
|
- name: Create Pull Request
|
|
|
|
id: cpr
|
2022-08-26 23:46:54 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
|
2021-07-12 17:06:18 +08:00
|
|
|
continue-on-error: true
|
2021-07-13 15:22:43 +08:00
|
|
|
uses: peter-evans/create-pull-request@v3
|
2021-07-13 15:12:27 +08:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
|
|
|
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
|
|
signoff: false
|
2021-07-13 15:44:48 +08:00
|
|
|
branch: update_builder_${{ github.sha }}
|
2021-07-13 15:12:27 +08:00
|
|
|
delete-branch: true
|
2021-07-13 16:06:26 +08:00
|
|
|
title: '[automated] Update Builder image changes'
|
2021-07-13 15:12:27 +08:00
|
|
|
body: |
|
2021-07-13 16:06:26 +08:00
|
|
|
Update Builder image changes
|
2022-08-26 23:46:54 +08:00
|
|
|
See changes: https://github.com/milvus-io/milvus/commit/${{ github.sha }}
|
2021-07-13 15:12:27 +08:00
|
|
|
Signed-off-by: ${{ github.actor }} ${{ github.actor }}@users.noreply.github.com
|
|
|
|
- name: Check outputs
|
2022-08-26 23:46:54 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
|
2021-07-12 18:11:32 +08:00
|
|
|
run: |
|
2021-07-13 15:12:27 +08:00
|
|
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
|
|
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|